File: qrouter.sh.in

package info (click to toggle)
qrouter 1.3.57-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,312 kB
  • ctags: 945
  • sloc: ansic: 13,500; sh: 7,492; makefile: 133; tcl: 3
file content (77 lines) | stat: -rwxr-xr-x 1,773 bytes parent folder | download | duplicates (3)
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/sh
#
# For installation, put this file (qrouter.sh) in a standard executable path.
# Put startup script "qrouter.tcl" and shared library "qrouter.so"
# in ${QROUTER_LIB_DIR}.
#
# This script starts qrouter under the Tcl interpreter,
# reading commands from script qrouter.tcl which launches qrouter
# and retains the Tcl interactive interpreter.

# Parse for the argument "-noc[onsole]".  If it exists, run qrouter
# without the TkCon console.  Strip this argument from the argument list.

loclibdir=${QROUTER_LIB_DIR:=LIBDIR}
export QROUTER_LIB_DIR
QROUTER_WISH=WISH_EXE
export QROUTER_WISH

# Hacks for Cygwin
if [ ${TERM:=""} = "cygwin" ]; then
   export PATH="$PATH:$loclibdir"
   export DISPLAY=${DISPLAY:=":0"}
fi

# Don't use the console if "-noc[onsole]" was specified.
# Also, if "-i", "-h", or "-c" is specified, then this is
# a batch-mode operation and the console should be ignored.
TKCON=true
NULLG=
ARGS=""
for i in $@ ; do
   case $i in
      -noc*)
	TKCON=
	;;
      -nog*)
	NULLG=true
	TKCON=
	;;
      -c*)
	TKCON=
	ARGS="$ARGS $i"
	;;
      -i* | -h*)
	NULLG=true
	TKCON=
	ARGS="$ARGS $i"
	;;
      *)
	ARGS="$ARGS $i"
	;;
   esac
done

set -- junk $ARGS
shift

if [ $TKCON ]; then

   exec /usr/bin/tkcon \
	-eval "source ${loclibdir}/console.tcl" \
	-slave "package require Tk; set argc $#; set argv [list $*]; \
	source ${loclibdir}/qrouter.tcl"
else

#
# Run the stand-in for wish (qrouterexec), which acts exactly like "wish"
# except that it replaces ~/.wishrc with qrouter.tcl.  This executable is
# *only* needed when running without the console; the console itself is
# capable of sourcing the startup script.
#
   if [ $NULLG ]; then
      exec ${loclibdir}/qrouternullg -- $@
   else
      exec ${loclibdir}/qrouterexec -- $@
   fi
fi