namespace eval CmdInput {\r
\r
- # We want to allow shell commands to execute automatically\r
- # as in normal interactive use. The "unknown" proc checks\r
- # that "info script" returns "", before it enables that\r
- # behaviour, so we subclass "info". In Tcl 8.4 we could simply\r
- # call 'info script ""' I believe, but 8.3 and earlier don't do\r
- # that.\r
- variable this_script [info script]\r
- proc info {args} {\r
- set result [uplevel [concat __org_info $args]]\r
- set cmd [lindex $args 0]\r
+ # We want to allow shell commands to execute automatically\r
+ # as in normal interactive use. The "unknown" proc checks\r
+ # that "info script" returns "", before it enables that\r
+ # behaviour, so we subclass "info". In Tcl 8.4 we could simply\r
+ # call 'info script ""' I believe, but 8.3 and earlier don't do\r
+ # that.\r
+ variable this_script [info script]\r
+ proc info {args} {\r
+ set result [uplevel [concat __org_info $args]]\r
+ set cmd [lindex $args 0]\r
\r
- variable this_script\r
- if {"script" == $cmd && "$result" == $this_script} {\r
- return ""\r
- } else {\r
- return $result\r
- }\r
- }\r
- rename ::info ::__org_info ;# using a namespace proc here cores\r
- proc ::info {args} "uplevel \[concat [namespace which info] \$args\]"\r
+ variable this_script\r
+ if {"script" == $cmd && "$result" == $this_script} {\r
+ return ""\r
+ } else {\r
+ return $result\r
+ }\r
+ }\r
+ rename ::info ::__org_info ;# using a namespace proc here cores\r
+ proc ::info {args} "uplevel \[concat [namespace which info] \$args\]"\r
\r
- proc loop {} {\r
- # preparations\r
- fconfigure stdin -buffering line\r
- fconfigure stdout -buffering line\r
- fconfigure stderr -buffering line\r
- set ::tcl_interactive 1\r
+ proc loop {} {\r
+ # preparations\r
+ fconfigure stdin -buffering line\r
+ fconfigure stdout -buffering line\r
+ fconfigure stderr -buffering line\r
+ set ::tcl_interactive 1\r
\r
- if {[file exists ~/tclshrc_WOK8.0]} {\r
- namespace eval :: {uplevel \#0 source ~/tclshrc_WOK8.3}\r
- }\r
+ if {[file exists ~/tclshrc.tcl]} {\r
+ namespace eval :: {uplevel \#0 source ~/tclshrc.tcl}\r
+ }\r
\r
- # input loop\r
- while {1} {\r
- catch {uplevel \#0 $::tcl_prompt1}\r
- flush stdout\r
- set cmd {}\r
- while {1} {\r
- append cmd [gets stdin] "\n"\r
- if {[info complete $cmd]} {\r
- break\r
- }\r
- catch {uplevel \#0 $::tcl_prompt2}\r
- flush stdout\r
- }\r
- history add $cmd\r
- catch {uplevel \#0 $cmd} result\r
- puts $result\r
- }\r
- return ""\r
- }\r
+ # input loop\r
+ while {1} {\r
+ catch {uplevel \#0 $::tcl_prompt1}\r
+ flush stdout\r
+ set cmd {}\r
+ while {1} {\r
+ append cmd [gets stdin] "\n"\r
+ if {[info complete $cmd]} {\r
+ break\r
+ }\r
+ catch {uplevel \#0 $::tcl_prompt2}\r
+ flush stdout\r
+ }\r
+ history add $cmd\r
+ catch {uplevel \#0 $cmd} result\r
+ puts $result\r
+ }\r
+ return ""\r
+ }\r
}\r
\r
catch {CmdInput::loop} result\r
puts $result\r
exit 0\r
+\r