I'm looking at documentation for lremove and it says it removes by
index. However, it appears to remove by a string match. Am I crazy? Is
the documentation wrong or is the command implemented wrongly?
Well I wrote this then answered my own question. Tkcon appears to
override the built-in lremove command with a different one. FYI.
(bin) 50 % info body lremove
array set opts {-all 0 pattern -exact}
while {[string match -* [lindex $args 0]]} {
switch -glob -- [lindex $args 0] {
-a* { set opts(-all) 1 }
-g* { set opts(pattern) -glob }
-r* { set opts(pattern) -regexp }
-- { set args [lreplace $args 0 0]; break }
default {return -code error "unknown option \"[lindex $args 0]\""}
}
set args [lreplace $args 0 0]
}
set l [lindex $args 0]
foreach i [join [lreplace $args 0 0]] {
if {[set ix [lsearch $opts(pattern) $l $i]] == -1} continue
set l [lreplace $l $ix $ix]
if {$opts(-all)} {
while {[set ix [lsearch $opts(pattern) $l $i]] != -1} {
set l [lreplace $l $ix $ix]
}
}
}
return $l
(bin) 51 %
| Sysop: | DaiTengu |
|---|---|
| Location: | Appleton, WI |
| Users: | 1,105 |
| Nodes: | 10 (0 / 10) |
| Uptime: | 492344:34:22 |
| Calls: | 14,158 |
| Calls today: | 2 |
| Files: | 186,284 |
| D/L today: |
2,078 files (822M bytes) |
| Messages: | 2,502,674 |