When lefty updated dotty, he assumes ksh and made dotty.sh basically
authorellson <devnull@localhost>
Tue, 18 Oct 2005 18:56:31 +0000 (18:56 +0000)
committerellson <devnull@localhost>
Tue, 18 Oct 2005 18:56:31 +0000 (18:56 +0000)
a ksh script, and no longer has a dotty.ksh. Moved dotty.sh to dotty.ksh,
and restored old vanilla dotty.sh.

cmd/dotty/dotty.sh

index 3bb2b1622876b108eba8ab8877771c13b6e3bd44..18d98e1217013763ac57998c7e7f035c4d7aaa7f 100755 (executable)
+#!/bin/sh
 
-set -A FILES
+FILES=""
 MLEVEL="0"
 LMODE="async"
-FLAGS=
 
-function usage {
-    print "usage: dotty [-V] [-lm (sync|async)] [-el (0|1)] <filename>"
-}
+usage='echo "usage: dotty [-V] [-lm (sync|async)] [-el (0|1)] <filename>"'
 
-function processoptions {
-    while [[ $# > 0 ]] do
-        case $1 in
-        -V)
-            print "dotty version 96c (09-24-96)"
-                       FLAGS=$FLAGS" -V"
-            shift
-            ;;
-        -f)
-            shift
-            loadfile=$1
-            shift
-            ;;
-        -lt)
-            shift
-            layouttool=$1
-            shift
-            ;;
-        -lm)
-            shift
-            LMODE=$1
-            if [[ $LMODE != 'sync' && $LMODE != 'async' ]] then
-                usage
-                exit 1
-            fi
-            shift
-            ;;
-        -el)
-            shift
-            MLEVEL=$1
-            if [[ $MLEVEL != '0' && $MLEVEL != '1' ]] then
-                usage
-                exit 1
-            fi
-            shift
-            ;;
-        -)
-            FILES[${#FILES[@]}]="'"$1"'"
-            shift
-            ;;
-        -*)
-            usage
-            exit 1
-            ;;
-        *)
-            FILES[${#FILES[@]}]="'"$1"'"
-            shift
-            ;;
-        esac
-    done
-}
-
-if [[ $DOTTYOPTIONS != '' ]] then
-    processoptions $DOTTYOPTIONS
+if [ "x$DOTTYOPTIONS" != "x" ]; then
+    set -- $DOTTYOPTIONS $*
 fi
-processoptions "$@"
 
-if [[ $DOTTYPATH != '' ]] then
-    export LEFTYPATH="$DOTTYPATH:$LEFTYPATH"
+while [ "x$1" != 'x' ]; do
+    case $1 in
+    -V)
+        echo "dotty version 96c (09-24-96)"
+               FLAGS=$FLAGS" -V"
+        shift
+        ;;
+    -f)
+        shift
+        loadfile=$1
+        shift
+        ;;
+    -lm)
+        shift
+        LMODE=$1
+        if [ "x$LMODE" != 'xsync' -a "x$LMODE" != 'xasync' ]; then
+            $usage
+            exit 1
+        fi
+        shift
+        ;;
+    -el)
+        shift
+        MLEVEL=$1
+        if [ "x$MLEVEL" != 'x0' -a "x$MLEVEL" != 'x1' ]; then
+            $usage
+            exit 1
+        fi
+        shift
+        ;;
+    -)
+        FILES=`echo $FILES \"$1\"`
+        shift
+        ;;
+    -*)
+        $usage
+        exit 1
+        ;;
+    *)
+        FILES=`echo $FILES \"$1\"`
+        shift
+        ;;
+    esac
+done
+
+if [ "x$DOTTYPATH" != 'x' ]; then
+    LEFTYPATH="$DOTTYPATH:$LEFTYPATH"
 fi
 
 CMDS=""
 
 CMDS="dotty.protogt.layoutmode = '$LMODE';"
 
-CMDS=$(print $CMDS dotty.mlevel = $MLEVEL";")
-
-if [[ $loadfile != '' ]] then
-    CMDS=$(print $CMDS load \("'"$loadfile"'"\)";")
-fi
+CMDS=`echo $CMDS dotty.mlevel = $MLEVEL";"`
 
-if [[ $layouttool != '' ]] then
-    CMDS=$(print $CMDS dotty.protogt.lserver = "'$layouttool';")
+if [ "x$loadfile" != 'x' ]; then
+    CMDS=`echo $CMDS load \("'"$loadfile"'"\)";"`
 fi
 
-if [[ $FILES = '' ]] then
+if [ "x$FILES" = 'x' ]; then
     FILES=null
 fi
 FUNC="dotty.createviewandgraph"
-for i in "${FILES[@]}"; do
-    CMDS=$(print $CMDS $FUNC \($i, "'"file"'", null, null\)";")
+for i in $FILES; do
+    CMDS=`echo $CMDS $FUNC \($i, "'"file"'", null, null\)";"`
 done
 
-leftypath=$(whence -p lefty)
-if [[ $leftypath == '' ]] then
-    print -u2 "dotty: cannot locate the lefty program"
-    print -u2 "       make sure that your path includes"
-    print -u2 "       the directory containing dotty and lefty"
+leftypath=`which lefty`
+if [ ! -f "$leftypath" ]; then
+    echo "dotty: cannot locate the lefty program"
+    echo "       make sure that your path includes"
+    echo "       the directory containing dotty and lefty"
     exit 1
 fi
 
-$leftypath $FLAGS -e "
+exec $leftypath -e "
 load ('dotty.lefty');
 checkpath = function () {
     if (tablesize (dotty) > 0)