Properly handle --re and -- flags.
Showing
1 changed file
with
14 additions
and
1 deletions
... | @@ -216,8 +216,21 @@ proc imap4d_test { args } { | ... | @@ -216,8 +216,21 @@ proc imap4d_test { args } { |
216 | set len [expr [llength $args] - 1] | 216 | set len [expr [llength $args] - 1] |
217 | 217 | ||
218 | if {$len >= 2} { | 218 | if {$len >= 2} { |
219 | set regexp 0 | ||
219 | for {set i 1} {$i <= [expr $len - 1]} {incr i} { | 220 | for {set i 1} {$i <= [expr $len - 1]} {incr i} { |
220 | set pattern [concat $pattern [list "* [lindex $args $i]"]] | 221 | switch -regexp -- "[lindex $args $i]" { |
222 | -re.*$ - | ||
223 | -- { set item "[lindex $args $i]"; set regexp 1 } | ||
224 | default { if {$regexp} { | ||
225 | set item "\\* [lindex $args $i]" | ||
226 | } else { | ||
227 | set item "* [lindex $args $i]" | ||
228 | } | ||
229 | set regexp 0 | ||
230 | } | ||
231 | } | ||
232 | |||
233 | set pattern [concat $pattern [list $item]] | ||
221 | } | 234 | } |
222 | set tagged [lindex $args end] | 235 | set tagged [lindex $args end] |
223 | } elseif {$len == 1} { | 236 | } elseif {$len == 1} { | ... | ... |
-
Please register or sign in to post a comment