| Description: |
Like other procedures in package csv also ::csv::split2matrix accepts a variable number of arguments but there are two 4 argument clauses in the switch command body, the second of them clearly handling 5 arguments instead. The package uses a foreach command to assign variables from the argument list which seems an idiomatic form in use before lassign was introduced
--- tcllib-2.0+dfsg/modules/csv/csv.tcl 2024-09-13 20:48:12.000000000 +0200
+++ ./csv.tcl 2026-02-04 17:02:00.567735401 +0100
@@ -575,12 +575,12 @@
set sepChar ,
set expand none
+ lassign $args a b c d e
switch -exact -- [llength $args] {
2 {
foreach {m line} $args break
}
3 {
- foreach {a b c} $args break
if {[string equal $a "-alternate"]} {
set alternate 1
set m $b
@@ -592,7 +592,6 @@
}
}
4 {
- foreach {a b c d} $args break
if {[string equal $a "-alternate"]} {
set alternate 1
set m $b
@@ -605,8 +604,7 @@
set expand $d
}
}
- 4 {
- foreach {a b c d e} $args break
+ 5 {
if {![string equal $a "-alternate"]} {
return -code error "wrong#args: Should be ?-alternate? m line ?separator? ?expand?"
}
|