File: nxwish

package info (click to toggle)
nsf 2.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 13,208 kB
  • sloc: ansic: 32,687; tcl: 10,723; sh: 660; pascal: 176; javascript: 135; lisp: 41; makefile: 24
file content (51 lines) | stat: -rwxr-xr-x 1,206 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#! /bin/sh
# Lookup a Tcl interpreter \
    INTERP="tclsh8.5"; \
    INTERPS="/usr/local/ns/bin/tclsh8.5 /usr/local/ns/bin/$INTERP"; \
    for interp in $INTERPS; \
    do if [ -x $interp ]; then INTERP=$interp; break; \
    fi;  done; \
    exec $INTERP "$0" ${1+"$@"}

# -*- tcl -*-
puts  [info nameofexecutable]

#
# Tiny scripted replacement of a binary nxwish (former xowish). This
# script can be used as interactive shell for testing or like a
# regular shell with the !# markup in the first line of a script. It
# is designed to work with multiple installed shells during
# development. For installed versions, it should be sufficient to
# remove the first line.
#
package require Tk
package require nx
namespace import ::nx::*

if {$argc == 0} {
  set prefix ""
  set line ""
  while {1} {
    update
    if {$line eq ""} {
       puts -nonewline "% "
       flush stdout
    }
    append line [gets stdin]
    if {[info complete $line]} {
      if {[catch $line result]} {
	puts $::errorInfo
      } else {
	puts $result
      }
      set line ""
      continue
    }
    append line \n 
  }
} else {
  set argv0 [lindex $argv 0]
  set argv  [lreplace $argv 0 0]
  incr argc -1
  source $argv0
}