]> granicus.if.org Git - graphviz/commitdiff
Back out lefty's use of lneato.sh as a ksh script; return to earlier
authorellson <devnull@localhost>
Tue, 18 Oct 2005 19:03:25 +0000 (19:03 +0000)
committerellson <devnull@localhost>
Tue, 18 Oct 2005 19:03:25 +0000 (19:03 +0000)
bourne shell script

cmd/lneato/lneato.sh

index ec79d1ed95476b6ba01f56af9055bc4685301fc2..2de3643edac3e05e0cd81e3eeea627867ae1b431 100755 (executable)
-
+#!/bin/sh
 FILES=""
 MLEVEL="0"
 LMODE="async"
-FLAGS=
-
-function usage {
-    print "usage: lneato [-V] [-lm (sync|async)] [-el (0|1)] <filename>"
-}
-
-function processoptions {
-    while [[ $# > 0 ]] do
-        case $1 in
-        -V)
-            print "lneato version 96c (09-24-96)"
-                       FLAGS=$FLAGS" -V"
-            shift
-            ;;
-        -f)
-            shift
-            loadfile=$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=$(print $FILES "'"$1"'")
-            shift
-            ;;
-        -*)
-            usage
-            exit 1
-            ;;
-        *)
-            FILES=$(print $FILES "'"$1"'")
-            shift
-            ;;
-        esac
-    done
-}
 
-if [[ $DOTTYOPTIONS != '' ]] then
-    processoptions $DOTTYOPTIONS
-fi
-processoptions "$@"
+usage="echo usage: lneato [-V] [-lm (sync|async)] [-el (0|1)] <filename>"
 
-if [[ $DOTTYPATH != '' ]] then
-    export LEFTYPATH="$DOTTYPATH:$LEFTYPATH"
+if test "x$DOTTYOPTIONS" != "x"
+then
+    options=$DOTTYOPTIONS
+else
+    options="$@"
 fi
 
-CMDS=""
+set -- $options
 
-CMDS="dotty.protogt.layoutmode = '$LMODE';"
+for i in "$@"
+do
+       if test "x$i" = "x$1"
+       then
+               case $i in
+               -V)
+                       shift
+                       echo "lneato version 95 (04-18-95)"
+                       FLAGS=$FLAGS" -V"
+                       ;;
+               -lm)
+                       shift
+                       LMODE="$1"
+                       shift
+                       if test "x$LMODE" != "xsync" -a "x$LMODE" != "xasync"
+                       then
+                               $usage
+                               exit 1
+                       fi
+                       ;;
+               -el)
+                       shift
+                       MLEVEL="$1"
+                       shift
+                       if test "x$MLEVEL" != "x0" -a "x$MLEVEL" != "x1"
+                       then
+                               $usage
+                               exit 1
+                       fi
+                       ;;
+               -?*)
+                       $usage
+                       exit 1
+                       ;;
+               *)
+                       FILES="$FILES '"$1"'"
+                       shift
+                       ;;
+               esac
+       fi
+done
 
-CMDS=$(print $CMDS dotty.mlevel = $MLEVEL";")
+if test "x$MLEVEL" != "x0"
+then
+       echo "FILES  = $FILES"
+       echo "MLEVEL = $MLEVEL"
+       echo "LMODE  = $LMODE"
+fi
 
-if [[ $loadfile != '' ]] then
-    CMDS=$(print $CMDS load \("'"$loadfile"'"\)";")
+if test "x$DOTTYPATH" != "x"
+then
+    LEFTYPATH="$DOTTYPATH:$LEFTYPATH"
 fi
 
-if [[ $FILES = '' ]] then
+CMDS="dotty.layoutmode = '$LMODE';"
+CMDS="$CMDS dotty.mlevel = $MLEVEL; dot.mlevel =  $MLEVEL;"
+
+if test "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="$CMDS dotty.createviewandgraph($i,'file',null,null);"
 done
 
-leftypath=$(whence -p lefty)
-if [[ $leftypath == '' ]] then
-    print -u2 "lneato: cannot locate the lefty program"
-    print -u2 "       make sure that your path includes"
-    print -u2 "       the directory containing lneato and lefty"
-    exit 1
-fi
-
-$leftypath $FLAGS -e "
+lefty -e "
 load ('dotty.lefty');
-dotty.protogt.lserver = 'neato';
+
 checkpath = function () {
-    if (tablesize (dotty) > 0)
-        remove ('checkpath');
-    else {
-        echo ('lneato: cannot locate the dotty scripts');
-        echo ('       make sure that the environment variable LEFTYPATH');
-        echo ('       is set to the directory containing dotty.lefty');
-        exit ();
-    }
+       if (tablesize(dotty) > 0);      # because tablesize(undef) returns "" not 0
+       else {
+               echo('You must set LEFTYPATH to the lefty lib directory path name.');
+               exit();
+       }
 };
 checkpath ();
+
+dotty.protogt.lserver = 'neato';
+dotty.protogt.graph.type = 'graph';
 dotty.init ();
 monitorfile = dotty.monitorfile;
 $CMDS