can't read "argv": no such variable
    while executing
"llength $argv"
    (in namespace eval "::request" script line 49)
    invoked from within
"namespace eval ::request $script"
    ("::try" body line 12)

OUTPUT BUFFER:

#!/usr/local/bin/wish # Conversion xbm <----> string proc strimj2xbm {strimj {tag "i"}} { set width [string length [lindex $strimj 0]] set height [llength $strimj] set bytes {} foreach line [string map {. 0} $strimj] { regsub -all {[^0]} $line 1 line ;# black pixel foreach bin [split [binary format b* $line] ""] { lappend bytes [scan $bin %c] } } set res "#define ${tag}_width $width\n#define ${tag}_height $height\n" append res "#define ${tag}_x_hot 7\n#define ${tag}_y_hot 7\n" append res "static unsigned char ${tag}_bits\[\] = {" foreach b $bytes { lappend Lb "0x[format %02x $b]" } append res "\n[join $Lb ", "]\n};\n" } proc strimj2image {strimj {fg black}} { image create bitmap -data [strimj2xbm $strimj] -foreground $fg } proc xbm2strimj Lxbm { set xbm [join $Lxbm "\n"] regexp {width +(\d+).+\{(.+)\}} $xbm tmp width data set res "" set line "" foreach byte [string map {, " "} $data] { if {[string length $line] > $width-7} { append res [string range $line 0 [expr {$width-1}]]\n set line "" } binary scan [format %c $byte] b* bits append line $bits } if {$line ne ""} { append res [string range $line 0 [expr {$width-1}]]\n } string map {0 . 1 @} $res } if {! [llength $argv]} { puts "\nUSAGE :" puts "\t xbmc \n" exit } set f $argv if {! [file exists $f]} { puts "\n\tERROR ! file $f does not exist !" puts "" exit } set o [open $f r] set Ll [split [read -nonewline $o] \n] close $o if {[file extension $f] eq ".xbm"} { set res [xbm2strimj $Ll] puts "$res" } else { set tag [file rootname $f] puts "[strimj2xbm $Ll $tag]" } exit