set i 0 while {$i < $argc} { if ![string compare "-m" [lindex $argv $i]] { incr i if $i==$argc { send_user "-m specified without machine, FAILING" exit -3 } set machine [lindex $argv $i] } elseif ![string compare "-n" [lindex $argv $i]] { incr i if $i==$argc { send_user "-n specified without name, FAILING" exit -3 } set name [lindex $argv $i] } elseif ![string compare "-p" [lindex $argv $i]] { incr i if $i==$argc { send_user "-p specified without password, FAILING" exit -3 } set password [lindex $argv $i] } elseif ![string compare "-c" [lindex $argv $i]] { incr i if $i==$argc { send_user "-c specified without argument, FAILING" exit -3 } set cmd [lindex $argv $i] } incr i }