+set showconfig 1
+while {[string match -* [set option [lindex $argv 0]]]} {
+ switch -exact -- $option {
+ -local {
+ set state(proxy) none
+ set clntPort 8080
+ set servHost localhost
+ set servPort 80
+ set showconfig 0
+ }
+ -proxy {
+ set state(proxy) http
+ if {[llength $argv] > 1 && ![string match -* [lindex $argv 1]]} {
+ set SP(proxyPort) [Pop argv 1]
+ set showconfig 0
+ }
+ }
+ -socks {
+ set state(proxy) socks
+ if {[llength $argv] > 1 && ![string match -* [lindex $argv 1]]} {
+ set SP(proxyPort) [Pop argv 1]
+ set showconfig 0
+ }
+ }
+ -myaddr {
+ set state(myaddr) [Pop argv 1]
+ }
+ -timeformat {
+ set state(timeFormat) [Pop argv 1]
+ }
+ -hex { set state(ascii) 0 }
+ -ascii { set state(ascii) 1 }
+ default {
+ return -code error "invalid option \"$option\": must be\
+ -local, -proxy, -socks or -myaddr"
+ }
+ }
+ Pop argv
+}