[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
PATCH: simplify regular expressions
From: |
Ben Elliston |
Subject: |
PATCH: simplify regular expressions |
Date: |
Mon, 10 Dec 2018 22:54:36 +1100 |
User-agent: |
NeoMutt/20170609 (1.8.3) |
This patch is further to:
http://lists.gnu.org/archive/html/dejagnu/2018-12/msg00042.html
I would be grateful for a careful review from someone.
Thanks,
Ben
2018-12-10 Ben Elliston <address@hidden>
* config/gdb-comm.exp, config/gdb_stub.exp, config/vxworks.exp,
lib/dg.exp, lib/framework.exp, lib/ftp.exp, lib/kermit.exp,
lib/rlogin.exp, lib/target.exp, lib/telnet.exp, runtest.exp,
testsuite/lib/libsup.exp: Simplify some regular expressions in
constant strings by placing them inside braces instead of
quotes. This allows one level of backslash quoting to be removed.
diff --git a/config/gdb-comm.exp b/config/gdb-comm.exp
index c9ef574..1e57eac 100644
--- a/config/gdb-comm.exp
+++ b/config/gdb-comm.exp
@@ -86,7 +86,7 @@ proc gdb_comm_file_cmd { arg } {
verbose "\t\tKilling previous program being debugged"
exp_continue
}
- -re "Load new symbol table from \".*\".*y or n.*$" {
+ -re {Load new symbol table from ".*".*y or n.*$" {
remote_send host "y\n"
remote_expect host 60 {
-re "Reading symbols from.*done.*$gdb_prompt $" {
@@ -157,7 +157,7 @@ proc gdb_comm_start { dest } {
# The variable gdb_prompt is a regexp which matches the gdb prompt. Set it
# if it is not already set.
if {![board_info $dest exists gdb_prompt]} then {
- set gdb_prompt "\\(gdb\\)"
+ set gdb_prompt {\(gdb\)}
} else {
set gdb_prompt [board_info $dest gdb_prompt]
}
@@ -199,7 +199,7 @@ proc gdb_comm_add_breakpoint { function } {
-re "Breakpoint.*$gdb_prompt $" { return "" }
-re "Function.*not defined.*$gdb_prompt $" { return "undef" }
-re "No symbol table.*$gdb_prompt $" { return "undef" }
- -re ".*Make breakpoint pending.*\\\? \\(y or \\\[n\\\]\\) $" {
+ -re {.*Make breakpoint pending.*\? \(y or \[n\]\) $} {
remote_send host "y\n"
return "maybe"
}
@@ -225,7 +225,7 @@ proc quit_gdb { } {
remote_send host "y\n"
exp_continue
}
- -re ".*\[*\]\[*\]\[*\].*EXIT code" { }
+ -re {.*[*][*][*].*EXIT code} { }
default { }
}
}
@@ -285,11 +285,11 @@ proc gdb_comm_load { dest prog args } {
set textoff [board_info $dest gdb_sect_offset]
remote_send host "sect .text $textoff\n"
remote_expect host 10 {
- -re "(0x\[0-9a-z]+) - 0x\[0-9a-z\]+ is \\.data" {
+ -re {(0x[0-9a-z]+) - 0x[0-9a-z]+ is \.data} {
set dataoff $expect_out(1,string)
exp_continue
}
- -re "(0x\[0-9a-z\]+) - 0x\[0-9a-z\]+ is \\.bss" {
+ -re {(0x[0-9a-z]+) - 0x[0-9a-z]+ is \.bss} {
set bssoff $expect_out(1,string)
exp_continue
}
@@ -425,7 +425,7 @@ proc gdb_comm_load { dest prog args } {
remote_send host "y\n"
exp_continue
}
- -re "Continuing( at |\\.| with no signal\\.)\[^\r\n\]*\[\r\n\]" {
+ -re {Continuing( at |\.| with no signal\.)[^\r\n]*[\r\n]} {
exp_continue
}
-re ".*Start it from the beginning?.*y or n.*" {
@@ -434,14 +434,14 @@ proc gdb_comm_load { dest prog args } {
-re ".*$gdb_prompt $" {
remote_send host "signal 0\n"
remote_expect host 10 {
- -re "signal 0\[\r\n\]+" { exp_continue }
- -re "Continuing(\\.| with no signal\\.)\[\r\n\]" {}
+ -re {signal 0[\r\n]+} { exp_continue }
+ -re {Continuing(\.| with no signal\.)[\r\n]} {}
}
}
}
exp_continue
}
- -re "(run\[\r\n\]*|)Starting program: \[^\r\n\]*\[\r\n\]" {
+ -re {(run[\r\n]*|)Starting program: [^\r\n]*[\r\n]} {
exp_continue
}
-re "$gdb_prompt (signal 0|continue)\[\r\n\]+Continuing(\\.| with no
signal\\.)\[\r\n\]" {
@@ -493,7 +493,7 @@ proc gdb_comm_load { dest prog args } {
remote_reboot $dest
return [list "fail" $output]
}
- -re "(.*)Program exited with code \[0-9\]+.*$gdb_prompt $" {
+ -re "(.*)Program exited with code [0-9]+.*$gdb_prompt $" {
set output $expect_out(1,string)
set status [check_for_board_status output]
gdb_comm_leave
diff --git a/config/gdb_stub.exp b/config/gdb_stub.exp
index b0bf61c..6ad22a1 100644
--- a/config/gdb_stub.exp
+++ b/config/gdb_stub.exp
@@ -37,7 +37,7 @@ proc gdb_stub_init { dest args } {
if {[board_info $dest exists gdb_prompt]} {
set gdb_prompt [board_info $dest gdb_prompt]
} else {
- set gdb_prompt "\\(gdb\\)"
+ set gdb_prompt {\(gdb\)}
}
return 1
@@ -384,7 +384,7 @@ proc gdb_stub_start { dest } {
remote_send host "jump relocd\n"
exp_continue
}
- -re "Continuing at.*\[\r\n\]" { }
+ -re {Continuing at.*[\r\n]} { }
default {
return { "fail" "" }
}
diff --git a/config/vxworks.exp b/config/vxworks.exp
index abf999d..b49a3f6 100644
--- a/config/vxworks.exp
+++ b/config/vxworks.exp
@@ -50,7 +50,7 @@ proc ${board}_init { dest } {
set boot_mon 0
set boot_mon_prompt "VxWorks Boot"
}
- -re "\[0-9\]\[\r\n\]+ *\[0-9\]\[\r\n\]" {
+ -re {[0-9][\r\n]+ *[0-9][\r\n]} {
remote_send $dest "\n"
exp_continue
}
@@ -72,7 +72,7 @@ proc ${board}_init { dest } {
}
remote_send $dest "p\n"
remote_expect $dest 20 {
- -re "file name\[ \t\]+: (\[^ \r\n\]+)\[ \r\n\]+" {
+ -re {file name[ \t]+: ([^ \r\n]+)[ \r\n]+} {
set curr_file $expect_out(1,string)
exp_continue
}
@@ -88,11 +88,11 @@ proc ${board}_init { dest } {
# Oh boy.
remote_send $dest "c\n"
remote_expect $dest 20 {
- -re "file name\[ \t\]+:.*$" {
+ -re {file name[ \t]+:.*$} {
remote_send $dest "$desired_kernel\n"
exp_continue
}
- -re "\[a-z() \t\]+:.*$" {
+ -re {[a-z() \t]+:.*$} {
remote_send $dest "\n"
exp_continue
}
@@ -141,7 +141,7 @@ proc vxworks_exec { dest program pargs inp outp } {
remote_send $dest "$program $pargs$suffix\n"
# FIXME: The value 300 below should probably be a parameter passed in.
remote_expect $dest 300 {
- -re "\\\[VxWorks Boot\\\]:" {
+ -re {\[VxWorks Boot\]:} {
remote_send $dest "@\n"
sleep 20
exp_continue
@@ -286,7 +286,7 @@ proc vxworks_ld { dest prog } {
remote_send $dest "\n"
remote_expect $dest 30 {
-re ".*$shell_prompt $" { set x 20 }
- -re "\\\[VxWorks Boot\\\]:" {
+ -re {\[VxWorks Boot\]:} {
remote_send $dest "@\n"
sleep 20
exp_continue
@@ -382,7 +382,7 @@ proc vxworks_run { dest function pargs inp outp } {
verbose "$function aborted"
set result 1
}
- -re "\[\r\n\]syntax error\[\r\n\]" {
+ -re {[\r\n]syntax error[\r\n]} {
verbose "weirdness after task started"
set result -1
}
diff --git a/lib/dg.exp b/lib/dg.exp
index 68c63a3..8ad8fd9 100644
--- a/lib/dg.exp
+++ b/lib/dg.exp
@@ -568,7 +568,7 @@ proc dg-runtest { testcases options default-extra-options }
{
#
proc dg-trim-dirname { dir_name file_name } {
set special_character "\[\?\+\-\.\(\)\$\|\]"
- regsub -all -- $special_character $dir_name "\\\\&" dir_name
+ regsub -all -- $special_character $dir_name {\\&} dir_name
regsub "^$dir_name/?" $file_name "" file_name
return $file_name
}
@@ -843,7 +843,7 @@ proc dg-test { args } {
# It would be a bit cumbersome though.
if {${dg-final-code} ne ""} {
- regsub -all "\\\\(\[{}\])" ${dg-final-code} "\\1" dg-final-code
+ regsub -all {\\([{}])} ${dg-final-code} {\1} dg-final-code
# Note that the use of `args' here makes this a varargs proc.
proc dg-final-proc { args } ${dg-final-code}
verbose "Running dg-final tests." 3
diff --git a/lib/framework.exp b/lib/framework.exp
index 5879ea6..a5ae572 100644
--- a/lib/framework.exp
+++ b/lib/framework.exp
@@ -292,7 +292,7 @@ proc clone_output { message } {
puts $sum_file $message
}
- regsub "^\[ \t\]*(\[^ \t\]+).*$" $message "\\1" firstword
+ regsub "^\[ \t\]*(\[^ \t\]+).*$" $message {\1} firstword
switch -glob -- $firstword {
"PASS:" -
"XFAIL:" -
diff --git a/lib/ftp.exp b/lib/ftp.exp
index e1cc1a9..ad3d8e9 100644
--- a/lib/ftp.exp
+++ b/lib/ftp.exp
@@ -186,7 +186,7 @@ proc ftp_download {host localfile remotefile} {
set loop 0
set remotefile ""
}
- -re "(^|\[\r\n\])150.*connection for (.*)
\[(\]\[0-9.,\]+\\)\[\r\n\]" {
+ -re {(^|[\r\n])150.*connection for (.*) [(][0-9.,]+\)[\r\n]} {
set remotefile $expect_out(2,string)
exp_continue
}
diff --git a/lib/kermit.exp b/lib/kermit.exp
index 6d06969..5630582 100644
--- a/lib/kermit.exp
+++ b/lib/kermit.exp
@@ -138,7 +138,7 @@ proc kermit_command {dest args} {
}
send -i $shell_id "c\r"
expect {
- -i $shell_id -re ".*other options.\[\r\n\]+" { }
+ -i $shell_id -re {.*other options.[\r\n]+} { }
-i $shell_id timeout {
perror "Unable to resume Kermit connection."
return -1
diff --git a/lib/rlogin.exp b/lib/rlogin.exp
index 30d2d1e..b16fcc2 100644
--- a/lib/rlogin.exp
+++ b/lib/rlogin.exp
@@ -70,7 +70,7 @@ proc rlogin_open { arg } {
set result 0
break
}
- -re "TERM = .*\\)\[ ]*$" {
+ -re {TERM = .*\)[ ]*$} {
send "dumb\r\n"
expect {
"Terminal type is*$" {
@@ -143,8 +143,8 @@ proc rlogin_spawn { dest cmdline } {
if { $shell_id ne "" && $shell_id > 0 } {
remote_send $dest "echo k\r"
remote_expect $dest 20 {
- -re "\\(gdb\\)" {
- set shell_prompt "\\(gdb\\)"
+ -re {\(gdb\)} {
+ set shell_prompt {\(gdb\)}
# gdb uses 'shell command'.
set prefix "shell "
set ok 1
diff --git a/lib/target.exp b/lib/target.exp
index 2620e30..3a40995 100644
--- a/lib/target.exp
+++ b/lib/target.exp
@@ -124,15 +124,15 @@ proc prune_warnings { text } {
regsub -all -- "\r" $text "" text
# This is from sun4's. Do it for all machines for now.
- # The "\\1" is to try to preserve a "\n" but only if necessary.
+ # The {\1} is to try to preserve a "\n" but only if necessary.
if {[ishost "sparc-*-sunos*"]} {
- regsub -all "(^|\n)(ld.so: warning:\[^\n\]*\n?)+" $text "\\1" text
+ regsub -all "(^|\n)(ld.so: warning:\[^\n\]*\n?)+" $text {\1} text
}
# See Brendan for the raison d'etre of this one.
# http://en.wikipedia.org/wiki/Brendan_Kehoe
if {[ishost "alpha*-*-*"]} {
- regsub -all "(^|\n)(/usr/(ucb|bin)/ld.*without exceptions
was\[^\n\]+\n?)" $text "\\1" text
+ regsub -all "(^|\n)(/usr/(ucb|bin)/ld.*without exceptions
was\[^\n\]+\n?)" $text {\1} text
}
if {[ishost "hppa*-*-hpux*"]} {
# Ignore the compiler's warnings about PA incompatibility.
@@ -197,72 +197,72 @@ proc prune_warnings { text } {
regsub -all "(^|\n)\[^\n\]*file path prefix \[^\n\]* never used" $text ""
text
# This is from sun4's. Do it for all machines for now.
- # The "\\1" is to try to preserve a "\n" but only if necessary.
- regsub -all "(^|\n)(ld.so: warning:\[^\n\]*\n?)+" $text "\\1" text
+ # The {\1} is to try to preserve a "\n" but only if necessary.
+ regsub -all "(^|\n)(ld.so: warning:\[^\n\]*\n?)+" $text {\1} text
# This happens when compiling on Alpha OSF/1 with cc -g -O.
- regsub -all "(^|\n)(\n*uopt: Warning: file not optimized; use -g3 if both
optimization and debug wanted\n?)+" $text "\\1" text
+ regsub -all "(^|\n)(\n*uopt: Warning: file not optimized; use -g3 if both
optimization and debug wanted\n?)+" $text {\1} text
# This happens when compiling on Alpha OSF using gas.
- regsub -all "(^|\n)(/usr/.*/ld:\nWarning: Linking some objects which
contain exception information sections\n\tand some which do not. This may cause
fatal runtime exception handling\n\tproblems\[^\n\]*\n?)+" $text "\\1" text
+ regsub -all "(^|\n)(/usr/.*/ld:\nWarning: Linking some objects which
contain exception information sections\n\tand some which do not. This may cause
fatal runtime exception handling\n\tproblems\[^\n\]*\n?)+" $text {\1} text
# This happens on SunOS with cc -g -O.
- regsub -all "(^|\n)(cc: Warning: -O conflicts with -g. -O turned
off.\n?)+" $text "\\1" text
+ regsub -all "(^|\n)(cc: Warning: -O conflicts with -g. -O turned
off.\n?)+" $text {\1} text
# This happens when assembling code with the native HP assembler
- regsub -all "(^|\n)(as:\[^\n\]*err#13.\n .warning.\[^\n\]*\n?)+" $text
"\\1" text
+ regsub -all "(^|\n)(as:\[^\n\]*err#13.\n .warning.\[^\n\]*\n?)+" $text
{\1} text
# When using the HP assembler, -g isn't supported.
- regsub -all "(^|\n)(cc1: warning: -g is only supported when using GAS on
this processor\[^\n\]*\ncc1: warning:\[^\n\]*\n?)+" $text "\\1" text
- regsub -all "(^|\n)(cc1plus: warning: -g is only supported when using GAS
on this processor\[^\n\]*\ncc1plus: warning:\[^\n\]*\n?)+" $text "\\1" text
+ regsub -all "(^|\n)(cc1: warning: -g is only supported when using GAS on
this processor\[^\n\]*\ncc1: warning:\[^\n\]*\n?)+" $text {\1} text
+ regsub -all "(^|\n)(cc1plus: warning: -g is only supported when using GAS
on this processor\[^\n\]*\ncc1plus: warning:\[^\n\]*\n?)+" $text {\1} text
# This happens when testing across NFS.
- regsub -all "(^|\n)((NFS|nfs) server \[^\n\]* not responding\[^\n\]*\n?)+"
$text "\\1" text
- regsub -all "(^|\n)((NFS|nfs) server \[^\n\]* (ok|is alive
again)\[^\n\]*\n?)+" $text "\\1" text
+ regsub -all "(^|\n)((NFS|nfs) server \[^\n\]* not responding\[^\n\]*\n?)+"
$text {\1} text
+ regsub -all "(^|\n)((NFS|nfs) server \[^\n\]* (ok|is alive
again)\[^\n\]*\n?)+" $text {\1} text
# This happens when testing across NFS on osf4.
- regsub -all "(^|\n)(NFS3 server \[^\n\]* not responding still
trying\[^\n\]*\n?)+" $text "\\1" text
- regsub -all "(^|\n)(NFS3 server \[^\n\]* ok\[^\n\]*\n?)+" $text "\\1" text
+ regsub -all "(^|\n)(NFS3 server \[^\n\]* not responding still
trying\[^\n\]*\n?)+" $text {\1} text
+ regsub -all "(^|\n)(NFS3 server \[^\n\]* ok\[^\n\]*\n?)+" $text {\1} text
# When using the IRIX 6 o32 assembler, -g isn't supported
- regsub -all "(^|\n)(cc1: warning: `-g' not supported by this configuration
of GCC\[^\n\]*\n?)+" $text "\\1" text
- regsub -all "(^|\n)(cc1plus: warning: `-g' not supported by this
configuration of GCC\[^\n\]*\n?)+" $text "\\1" text
+ regsub -all "(^|\n)(cc1: warning: `-g' not supported by this configuration
of GCC\[^\n\]*\n?)+" $text {\1} text
+ regsub -all "(^|\n)(cc1plus: warning: `-g' not supported by this
configuration of GCC\[^\n\]*\n?)+" $text {\1} text
- regsub -all "(^|\n)(cc1: warning: -mabi=32 does not support
-g\[^\n\]*\n?)+" $text "\\1" text
- regsub -all "(^|\n)(cc1plus: warning: -mabi=32 does not support
-g\[^\n\]*\n?)+" $text "\\1" text
+ regsub -all "(^|\n)(cc1: warning: -mabi=32 does not support
-g\[^\n\]*\n?)+" $text {\1} text
+ regsub -all "(^|\n)(cc1plus: warning: -mabi=32 does not support
-g\[^\n\]*\n?)+" $text {\1} text
# This happens with the o32 assembler on IRIX 6.
- regsub -all "(^|\n)(as: Warning: -O3 is not supported for assembly
compiles for ucode compilers; changing to -O2.\n?)+" $text "\\1" text
+ regsub -all "(^|\n)(as: Warning: -O3 is not supported for assembly
compiles for ucode compilers; changing to -O2.\n?)+" $text {\1} text
# This happens when using g++ on a DWARF system.
- regsub -all "(^|\n)(cc1plus: warning: -g option not supported for C\\+\\+
on systems using the DWARF debugging format\n?)+" $text "\\1" text
+ regsub -all "(^|\n)(cc1plus: warning: -g option not supported for C\\+\\+
on systems using the DWARF debugging format\n?)+" $text {\1} text
# This is from sun4's. Do it for all machines for now.
- # The "\\1" is to try to preserve a "\n" but only if necessary.
- regsub -all "(^|\n)(ld.so: warning:\[^\n\]*\n?)+" $text "\\1" text
+ # The {\1} is to try to preserve a "\n" but only if necessary.
+ regsub -all "(^|\n)(ld.so: warning:\[^\n\]*\n?)+" $text {\1} text
# See Brendan for the raison d'etre of this one.
# http://en.wikipedia.org/wiki/Brendan_Kehoe
if {[string match "alpha*-*-*" $host_triplet]} {
- regsub -all "(^|\n)(/usr/(ucb|bin)/ld.*without exceptions
was\[^\n\]+\n?)" $text "\\1" text
+ regsub -all "(^|\n)(/usr/(ucb|bin)/ld.*without exceptions
was\[^\n\]+\n?)" $text {\1} text
}
# Don't pay attention to the AIX4 linker warnings.
- regsub -all "(^|\n)(ld:.*WARNING: Duplicate.*ld:.*Use the
-bload\[^\n\]*\n?)" $text "\\1" text
+ regsub -all "(^|\n)(ld:.*WARNING: Duplicate.*ld:.*Use the
-bload\[^\n\]*\n?)" $text {\1} text
# Or the IRIX 6 ones.
- regsub -all "(^|\n)(ld(|32|64): WARNING \[^\n\]*\n?)+" $text "\\1" text
- regsub -all "(^|\n)(ld(|32|64): Giving up.*Use -wall\[^\n\]*\n?)+" $text
"\\1" text
+ regsub -all "(^|\n)(ld(|32|64): WARNING \[^\n\]*\n?)+" $text {\1} text
+ regsub -all "(^|\n)(ld(|32|64): Giving up.*Use -wall\[^\n\]*\n?)+" $text
{\1} text
# Or the NetBSD ones.
- regsub -all "(^|\n)(\[^\n\]*: In function\[^\n\]*\n\[^\n\]\[^\n\]*warning:
this program uses \[^\n\]*)" $text "\\1" text
- regsub -all "(^|\n)(\[^\n\]*: In function\[^\n\]*\n\[^\n\]\[^\n\]*warning:
reference to compatibility \[^\n\]*)" $text "\\1" text
- regsub -all "(^|\n)(\[^\n\]*:\[0-9\]+: warning: \[^\n\]* possibly used
unsafely, use \[^\n\]*\n?)" $text "\\1" text
- regsub -all "(^|\n)(\[^\n\]*: warning: reference to compatibility
glob\[^\n\]*\n?)" $text "\\1" text
+ regsub -all "(^|\n)(\[^\n\]*: In function\[^\n\]*\n\[^\n\]\[^\n\]*warning:
this program uses \[^\n\]*)" $text {\1} text
+ regsub -all "(^|\n)(\[^\n\]*: In function\[^\n\]*\n\[^\n\]\[^\n\]*warning:
reference to compatibility \[^\n\]*)" $text {\1} text
+ regsub -all "(^|\n)(\[^\n\]*:\[0-9\]+: warning: \[^\n\]* possibly used
unsafely, use \[^\n\]*\n?)" $text {\1} text
+ regsub -all "(^|\n)(\[^\n\]*: warning: reference to compatibility
glob\[^\n\]*\n?)" $text {\1} text
# Or the OpenBSD ones.
- regsub -all "(^|\n)(\[^\n\]*: In function\[^\n\]*\n\[^\n\]\[^\n\]*warning:
\[^\n\]* is (often|almost always) misused, please use \[^\n\]*\n?)" $text "\\1"
text
- regsub -all "(^|\n)(\[^\n\]*: warning: \[^\n\]* is (often|almost always)
misused, please use \[^\n\]*\n?)" $text "\\1" text
+ regsub -all "(^|\n)(\[^\n\]*: In function\[^\n\]*\n\[^\n\]\[^\n\]*warning:
\[^\n\]* is (often|almost always) misused, please use \[^\n\]*\n?)" $text {\1}
text
+ regsub -all "(^|\n)(\[^\n\]*: warning: \[^\n\]* is (often|almost always)
misused, please use \[^\n\]*\n?)" $text {\1} text
# GNU ld warns about functions marked as dangerous in GNU libc.
regsub -all "(^|\n)\[^\n\]*: In function\[^\n\]*\n\[^\n\]\[^\n\]*is
dangerous\[^\n\]*" $text "" text
diff --git a/lib/telnet.exp b/lib/telnet.exp
index 219684a..abb7db0 100644
--- a/lib/telnet.exp
+++ b/lib/telnet.exp
@@ -119,7 +119,7 @@ proc telnet_open { hostname args } {
perror "telnet: need a password"
break
}
- -re "advance.*y/n.*\\?" {
+ -re {advance.*y/n.*\?} {
exp_send "n\n"
exp_continue
}
@@ -140,7 +140,7 @@ proc telnet_open { hostname args } {
sleep 20
exp_continue
}
- -re "Escape character is.*\\.\[\r\n\]" {
+ -re {Escape character is.*\.[\r\n]} {
if { $raw || [board_info $connhost exists dont_wait_for_prompt]
} {
set result 0
} else {
@@ -170,7 +170,7 @@ proc telnet_open { hostname args } {
warning "telnet: connection closed by foreign host."
break
}
- -re "\[\r\n\]+" {
+ -re {[\r\n]+} {
exp_continue
}
timeout {
@@ -227,11 +227,11 @@ proc telnet_binary { hostname } {
remote_send $hostname "toggle binary\n"
exp_continue
}
- -re "Negotiating binary.*\[\r\n\].*$" { }
+ -re {Negotiating binary.*[\r\n].*$} { }
-re "binary.*unknown argument.*telnet> *$" {
remote_send $hostname "mode character\n"
}
- -re "Already operating in binary.*\[\r\n\].*$" { }
+ -re {Already operating in binary.*[\r\n].*$} { }
timeout {
warning "Never got binary response from telnet."
}
diff --git a/runtest.exp b/runtest.exp
index 0bfca7d..eb18d7d 100644
--- a/runtest.exp
+++ b/runtest.exp
@@ -1563,16 +1563,16 @@ proc process_target_variants { target_list } {
set result {}
foreach x $target_list {
if {[regexp "\\(" $x]} {
- regsub "^.*\\((\[^()\]*)\\)$" "$x" "\\1" variant_list
- regsub "\\(\[^(\]*$" "$x" "" x
+ regsub {^.*\(([^()]*)\)$} $x {\1} variant_list
+ regsub "\\(\[^(\]*$" $x "" x
set list [process_target_variants $x]
set result {}
foreach x $list {
set result [concat $result [iterate_target_variants $x [split
$variant_list ","]]]
}
} elseif {[regexp "\{" $x]} {
- regsub "^.*\{(\[^\{\}\]*)\}$" "$x" "\\1" variant_list
- regsub "\{\[^\{\]*$" "$x" "" x
+ regsub "^.*\{(\[^\{\}\]*)\}$" $x {\1} variant_list
+ regsub "\{\[^\{\]*$" $x "" x
set list [process_target_variants $x]
foreach x $list {
foreach i [split $variant_list ","] {
diff --git a/testsuite/lib/libsup.exp b/testsuite/lib/libsup.exp
index 9512e5e..4d167e1 100644
--- a/testsuite/lib/libsup.exp
+++ b/testsuite/lib/libsup.exp
@@ -196,7 +196,7 @@ proc config_test { cmd true false msg } {
}
expect {
- -re "Checking pattern*with*\[\r\n\]" {
+ -re {Checking pattern*with*[\r\n]} {
exp_continue
}
-re "\r\n1\r\n" {
signature.asc
Description: PGP signature
- PATCH: simplify regular expressions,
Ben Elliston <=