#!/afs/ece/usr/tcl/bin/wish -f
# The next line is executed by most shells, but not Tcl \
wish $0 $*

#
# Adds TH bindings & calls args next.
#


source "[file dirname [info script]]/../lib/tk.tcl"
if {[string first [string index [lindex $argv 0] 0] "/~"] >= 0} {
  set arg0 [lindex $argv 0]
} else {
  foreach path [split $env(PATH) ":"] {
    if {[file executable $path/[lindex $argv 0]]} {
      set arg0 "$path/[lindex $argv 0]"
      break
  }}
  unset path
}

if {[catch "set arg0"]} {error "Can't execute [lindex $argv 0], no such file"}

if {[tk appname] == "thbind"} {tk appname [file tail $arg0]}
set argv [lrange $argv 1 end]
incr argc -1
source $arg0
