diff options
author | Ben Elliston <bje@gnu.org> | 2018-12-10 19:28:46 +1100 |
---|---|---|
committer | Ben Elliston <bje@gnu.org> | 2018-12-10 19:28:46 +1100 |
commit | 6c0bbbfad3f00a2371ef42178b092ffb5ea23eaf (patch) | |
tree | 73792e401d6be0a5e2c37a33a48c2cd7956fb0aa | |
parent | 09e9d5e47f83a3953e51e2b3d0e4b85fd411f8d1 (diff) | |
download | dejagnu-6c0bbbfad3f00a2371ef42178b092ffb5ea23eaf.zip dejagnu-6c0bbbfad3f00a2371ef42178b092ffb5ea23eaf.tar.gz dejagnu-6c0bbbfad3f00a2371ef42178b092ffb5ea23eaf.tar.bz2 |
* lib/utils.exp (grep): Use a proper Tcl list for options.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | lib/utils.exp | 10 |
2 files changed, 9 insertions, 5 deletions
@@ -1,5 +1,9 @@ 2018-12-10 Ben Elliston <bje@gnu.org> + * lib/utils.exp (grep): Use a proper Tcl list for options. + +2018-12-10 Ben Elliston <bje@gnu.org> + * testsuite/runtest.all/utils.test: ${srcdir} -> $srcdir. * lib/utils.exp (getdirs): Use glob -nocomplain rather than glob diff --git a/lib/utils.exp b/lib/utils.exp index 6acfa7c..3a01e7e 100644 --- a/lib/utils.exp +++ b/lib/utils.exp @@ -201,9 +201,9 @@ proc which { file } { # line - synonum for -n proc grep { args } { - set options "" + set options [list] if { [lindex $args 0] eq "-n" } { - append options "line " + lappend options "line" set args [lrange $args 1 end] } @@ -213,16 +213,16 @@ proc grep { args } { verbose "Grepping $file for the pattern \"$pattern\"" 3 if { [llength $args] > 2 } { - append options [join [lrange $args 2 end]] + set options [concat $options [lrange $args 2 end]] } set options [lsort -unique $options] set i 0 set fd [open $file r] - while { [gets $fd cur_line]>=0 } { + while { [gets $fd cur_line] >= 0 } { incr i if {[regexp -- $pattern $cur_line match]} { - if {$options ne ""} { + if {[llength $options] > 0} { foreach opt $options { switch -- $opt { "line" { |