#!$HOME/tcl_core/usr_special/bin/tclsh9.0

# ./cscan
set cscan_testlist {
    0o110 %o i
    0d110 %d i
    0x110 %x i
    0b110 %b i
    true %b i
    0 %b i
    0110 %o i
    110 %o i
    110 %i i
    110.3ms %lg d
    0d10 %x i
    0b10 %x i
    0x10 %x i
}

puts [exec ./cscan]\n

foreach line [split $cscan_testlist \n] {
    if {[llength $line]} {
	puts [exec ./cscan {*}$line]
	lassign $line str fmt v
	set remainder BAAD
	set $v -777
	puts " scan  \"$str\"  \"${fmt}%s\"  $v    remainder  -> returned [scan $str ${fmt}%s $v remainder], results ${v}=[expr {[info exists $v] ? [set $v] : {baad}}] remainder=\"$remainder\""
    }
}
