improved scripts for Kaffe

Alexandre Oliva oliva at dcc.unicamp.br
Tue Sep 8 20:07:02 PDT 1998


--Multipart_Wed_Sep__9_03:07:03_1998-1
Content-Type: text/plain; charset=US-ASCII

This patch adds improves Kaffe scripts in two senses:

1) all scripts used to need PATH to contain the directory where some
other scripts or Kaffe is to be found.  Now they no longer need this,
as they will look for Kaffe and scripts in KAFFE_HOME/bin, if
KAFFE_HOME is set.  If not set or not found, it will search for them
in the directory where the running script lives, following
soft-links.  If the searched program is not found there either, the
original PATH search is performed as a last resort.

2) the kaffe script now eases debugging of Kaffe, by providing support
for starting command-line or emacs-driven gdb, properly setting the
working directory and the argument list for the gdb session

-- 
Alexandre Oliva
mailto:oliva at dcc.unicamp.br mailto:aoliva at acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil

--Multipart_Wed_Sep__9_03:07:03_1998-1
Content-Type: application/octet-stream; type=patch
Content-Disposition: attachment; filename="scripts.diff"
Content-Transfer-Encoding: 7bit

  Alexandre Oliva  <oliva at dcc.unicamp.br>

	* kaffe/scripts/kaffe.in: if KAFFE_DEBUG is defined to either
	gdb or (some variant of) emacs, start a debugging session with
	working directory and argument list properly set

	* kaffe/scripts/appletviewer: if KAFFE_HOME is not set, look
	for other scripts and/or Kaffe in the directory that contains
	the script, following soft links, so that no environment
	variable has to be set
	* kaffe/scripts/jar: ditto
	* kaffe/scripts/javac: ditto
	* kaffe/scripts/javadoc: ditto
	* kaffe/scripts/javakey: ditto
	* kaffe/scripts/javap: ditto
	* kaffe/scripts/jdb: ditto
	* kaffe/scripts/native2ascii: ditto
	* kaffe/scripts/pizza: ditto
	* kaffe/scripts/pizzadoc: ditto
	* kaffe/scripts/rmic: ditto
	* kaffe/scripts/rmiregistry: ditto
	* kaffe/scripts/serialver: ditto
	* kaffe/scripts/compat/appletviewer: ditto
	* kaffe/scripts/compat/java: ditto
	* kaffe/scripts/compat/javac: ditto
	* kaffe/scripts/compat/javadoc: ditto

Index: kaffe/scripts/appletviewer
===================================================================
RCS file: /home/msc/oliva/src/.cvs/kaffe/kaffe/scripts/appletviewer,v
retrieving revision 1.1.1.4
retrieving revision 1.3
diff -u -r1.1.1.4 -r1.3
--- kaffe/scripts/appletviewer	1998/08/05 22:18:01	1.1.1.4
+++ kaffe/scripts/appletviewer	1998/09/07 19:29:44	1.3
@@ -1,3 +1,30 @@
 #! /bin/sh
 # Script to run Appletviewer
-exec java sun.applet.AppletViewer "$@"
+runme=java
+if test x"${KAFFE_HOME+set}"x = x"set"x &&
+   test -x "$KAFFE_HOME/bin/$runme"; then
+    # use $runme from $KAFFE_HOME/bin
+    runme="$KAFFE_HOME/bin/$runme"
+else
+    # if not set or not found, use the same directory that contains
+    # this script, after following soft-links
+    file="$0"
+    while test -h "$file"; do
+	# follow soft-links.
+	# first, find out the link name, printed after ` -> ' in ls output
+	newfile=`ls -l "$file" | sed s/'.* -> '//`
+	case "$newfile" in
+	/*) # absolute link: just use it
+	    file="$newfile";;
+	*)  # relative link: concat current basedir with link
+	    file=`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'`/"$newfile";;
+	esac
+    done
+    # remove trailing slash and basename
+    # (avoid duplicated output by redirecting cd to /dev/null)
+    basedir=`cd \`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'\` >/dev/null 2>&1; pwd`
+    # if $runme exists in basedir, use it
+    if test -x "$basedir/$runme"; then runme="$basedir/$runme"; fi
+    # otherwise, it will be searched in the PATH...
+fi
+exec "$runme" sun.applet.AppletViewer ${1+"$@"}
Index: kaffe/scripts/jar
===================================================================
RCS file: /home/msc/oliva/src/.cvs/kaffe/kaffe/scripts/jar,v
retrieving revision 1.1.1.3
retrieving revision 1.3
diff -u -r1.1.1.3 -r1.3
--- jar	1998/08/05 22:18:03	1.1.1.3
+++ jar	1998/09/07 19:29:44	1.3
@@ -1,2 +1,29 @@
 #! /bin/sh
-exec java sun.tools.jar.Main "$@"
+runme=java
+if test x"${KAFFE_HOME+set}"x = x"set"x &&
+   test -x "$KAFFE_HOME/bin/$runme"; then
+    # use $runme from $KAFFE_HOME/bin
+    runme="$KAFFE_HOME/bin/$runme"
+else
+    # if not set or not found, use the same directory that contains
+    # this script, after following soft-links
+    file="$0"
+    while test -h "$file"; do
+	# follow soft-links.
+	# first, find out the link name, printed after ` -> ' in ls output
+	newfile=`ls -l "$file" | sed s/'.* -> '//`
+	case "$newfile" in
+	/*) # absolute link: just use it
+	    file="$newfile";;
+	*)  # relative link: concat current basedir with link
+	    file=`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'`/"$newfile";;
+	esac
+    done
+    # remove trailing slash and basename
+    # (avoid duplicated output by redirecting cd to /dev/null)
+    basedir=`cd \`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'\` >/dev/null 2>&1; pwd`
+    # if $runme exists in basedir, use it
+    if test -x "$basedir/$runme"; then runme="$basedir/$runme"; fi
+    # otherwise, it will be searched in the PATH...
+fi
+exec "$runme" sun.tools.jar.Main ${1+"$@"}
Index: kaffe/scripts/javac
===================================================================
RCS file: /home/msc/oliva/src/.cvs/kaffe/kaffe/scripts/javac,v
retrieving revision 1.1.1.4
retrieving revision 1.3
diff -u -r1.1.1.4 -r1.3
--- kaffe/scripts/javac	1998/08/05 22:18:04	1.1.1.4
+++ kaffe/scripts/javac	1998/09/07 19:29:44	1.3
@@ -1,3 +1,30 @@
 #! /bin/sh
 # Script to run Sun's compiler
-exec java sun.tools.javac.Main "$@"
+runme=java
+if test x"${KAFFE_HOME+set}"x = x"set"x &&
+   test -x "$KAFFE_HOME/bin/$runme"; then
+    # use $runme from $KAFFE_HOME/bin
+    runme="$KAFFE_HOME/bin/$runme"
+else
+    # if not set or not found, use the same directory that contains
+    # this script, after following soft-links
+    file="$0"
+    while test -h "$file"; do
+	# follow soft-links.
+	# first, find out the link name, printed after ` -> ' in ls output
+	newfile=`ls -l "$file" | sed s/'.* -> '//`
+	case "$newfile" in
+	/*) # absolute link: just use it
+	    file="$newfile";;
+	*)  # relative link: concat current basedir with link
+	    file=`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'`/"$newfile";;
+	esac
+    done
+    # remove trailing slash and basename
+    # (avoid duplicated output by redirecting cd to /dev/null)
+    basedir=`cd \`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'\` >/dev/null 2>&1; pwd`
+    # if $runme exists in basedir, use it
+    if test -x "$basedir/$runme"; then runme="$basedir/$runme"; fi
+    # otherwise, it will be searched in the PATH...
+fi
+exec "$runme" sun.tools.javac.Main ${1+"$@"}
Index: kaffe/scripts/javadoc
===================================================================
RCS file: /home/msc/oliva/src/.cvs/kaffe/kaffe/scripts/javadoc,v
retrieving revision 1.1.1.4
retrieving revision 1.3
diff -u -r1.1.1.4 -r1.3
--- kaffe/scripts/javadoc	1998/08/05 22:18:06	1.1.1.4
+++ kaffe/scripts/javadoc	1998/09/07 19:29:45	1.3
@@ -1,3 +1,30 @@
 #! /bin/sh
 # Script to run Sun's documenter
-exec java sun.tools.javadoc.Main "$@"
+runme=java
+if test x"${KAFFE_HOME+set}"x = x"set"x &&
+   test -x "$KAFFE_HOME/bin/$runme"; then
+    # use $runme from $KAFFE_HOME/bin
+    runme="$KAFFE_HOME/bin/$runme"
+else
+    # if not set or not found, use the same directory that contains
+    # this script, after following soft-links
+    file="$0"
+    while test -h "$file"; do
+	# follow soft-links.
+	# first, find out the link name, printed after ` -> ' in ls output
+	newfile=`ls -l "$file" | sed s/'.* -> '//`
+	case "$newfile" in
+	/*) # absolute link: just use it
+	    file="$newfile";;
+	*)  # relative link: concat current basedir with link
+	    file=`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'`/"$newfile";;
+	esac
+    done
+    # remove trailing slash and basename
+    # (avoid duplicated output by redirecting cd to /dev/null)
+    basedir=`cd \`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'\` >/dev/null 2>&1; pwd`
+    # if $runme exists in basedir, use it
+    if test -x "$basedir/$runme"; then runme="$basedir/$runme"; fi
+    # otherwise, it will be searched in the PATH...
+fi
+exec "$runme" sun.tools.javadoc.Main ${1+"$@"}
Index: kaffe/scripts/javakey
===================================================================
RCS file: /home/msc/oliva/src/.cvs/kaffe/kaffe/scripts/javakey,v
retrieving revision 1.1.1.3
retrieving revision 1.3
diff -u -r1.1.1.3 -r1.3
--- kaffe/scripts/javakey	1998/08/05 22:18:08	1.1.1.3
+++ kaffe/scripts/javakey	1998/09/07 19:29:45	1.3
@@ -1,2 +1,29 @@
 #! /bin/sh
-exec java sun.security.provider.Main "$@"
+runme=java
+if test x"${KAFFE_HOME+set}"x = x"set"x &&
+   test -x "$KAFFE_HOME/bin/$runme"; then
+    # use $runme from $KAFFE_HOME/bin
+    runme="$KAFFE_HOME/bin/$runme"
+else
+    # if not set or not found, use the same directory that contains
+    # this script, after following soft-links
+    file="$0"
+    while test -h "$file"; do
+	# follow soft-links.
+	# first, find out the link name, printed after ` -> ' in ls output
+	newfile=`ls -l "$file" | sed s/'.* -> '//`
+	case "$newfile" in
+	/*) # absolute link: just use it
+	    file="$newfile";;
+	*)  # relative link: concat current basedir with link
+	    file=`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'`/"$newfile";;
+	esac
+    done
+    # remove trailing slash and basename
+    # (avoid duplicated output by redirecting cd to /dev/null)
+    basedir=`cd \`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'\` >/dev/null 2>&1; pwd`
+    # if $runme exists in basedir, use it
+    if test -x "$basedir/$runme"; then runme="$basedir/$runme"; fi
+    # otherwise, it will be searched in the PATH...
+fi
+exec "$runme" sun.security.provider.Main ${1+"$@"}
Index: kaffe/scripts/javap
===================================================================
RCS file: /home/msc/oliva/src/.cvs/kaffe/kaffe/scripts/javap,v
retrieving revision 1.1.1.3
retrieving revision 1.3
diff -u -r1.1.1.3 -r1.3
--- kaffe/scripts/javap	1998/08/05 22:18:10	1.1.1.3
+++ kaffe/scripts/javap	1998/09/07 19:29:45	1.3
@@ -1,2 +1,29 @@
 #! /bin/sh
-exec java sun.tools.javap.JavaP "$@"
+runme=java
+if test x"${KAFFE_HOME+set}"x = x"set"x &&
+   test -x "$KAFFE_HOME/bin/$runme"; then
+    # use $runme from $KAFFE_HOME/bin
+    runme="$KAFFE_HOME/bin/$runme"
+else
+    # if not set or not found, use the same directory that contains
+    # this script, after following soft-links
+    file="$0"
+    while test -h "$file"; do
+	# follow soft-links.
+	# first, find out the link name, printed after ` -> ' in ls output
+	newfile=`ls -l "$file" | sed s/'.* -> '//`
+	case "$newfile" in
+	/*) # absolute link: just use it
+	    file="$newfile";;
+	*)  # relative link: concat current basedir with link
+	    file=`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'`/"$newfile";;
+	esac
+    done
+    # remove trailing slash and basename
+    # (avoid duplicated output by redirecting cd to /dev/null)
+    basedir=`cd \`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'\` >/dev/null 2>&1; pwd`
+    # if $runme exists in basedir, use it
+    if test -x "$basedir/$runme"; then runme="$basedir/$runme"; fi
+    # otherwise, it will be searched in the PATH...
+fi
+exec "$runme" sun.tools.javap.JavaP ${1+"$@"}
Index: kaffe/scripts/jdb
===================================================================
RCS file: /home/msc/oliva/src/.cvs/kaffe/kaffe/scripts/jdb,v
retrieving revision 1.1.1.3
retrieving revision 1.3
diff -u -r1.1.1.3 -r1.3
--- kaffe/scripts/jdb	1998/08/05 22:18:11	1.1.1.3
+++ kaffe/scripts/jdb	1998/09/07 19:29:45	1.3
@@ -1,2 +1,29 @@
 #! /bin/sh
-exec java sun.tools.ttydebug.TTY "$@"
+runme=java
+if test x"${KAFFE_HOME+set}"x = x"set"x &&
+   test -x "$KAFFE_HOME/bin/$runme"; then
+    # use $runme from $KAFFE_HOME/bin
+    runme="$KAFFE_HOME/bin/$runme"
+else
+    # if not set or not found, use the same directory that contains
+    # this script, after following soft-links
+    file="$0"
+    while test -h "$file"; do
+	# follow soft-links.
+	# first, find out the link name, printed after ` -> ' in ls output
+	newfile=`ls -l "$file" | sed s/'.* -> '//`
+	case "$newfile" in
+	/*) # absolute link: just use it
+	    file="$newfile";;
+	*)  # relative link: concat current basedir with link
+	    file=`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'`/"$newfile";;
+	esac
+    done
+    # remove trailing slash and basename
+    # (avoid duplicated output by redirecting cd to /dev/null)
+    basedir=`cd \`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'\` >/dev/null 2>&1; pwd`
+    # if $runme exists in basedir, use it
+    if test -x "$basedir/$runme"; then runme="$basedir/$runme"; fi
+    # otherwise, it will be searched in the PATH...
+fi
+exec "$runme" sun.tools.ttydebug.TTY ${1+"$@"}
Index: kaffe/scripts/kaffe.in
===================================================================
RCS file: /home/msc/oliva/src/.cvs/kaffe/kaffe/scripts/kaffe.in,v
retrieving revision 1.1.1.3
retrieving revision 1.4
diff -u -r1.1.1.3 -r1.4
--- kaffe/scripts/kaffe.in	1998/09/07 17:17:58	1.1.1.3
+++ kaffe/scripts/kaffe.in	1998/09/07 19:29:46	1.4
@@ -14,16 +14,45 @@
 #	2. Klasses.jar in $prefix/share/kaffe
 #	3. pizza.jar in $prefix/share/kaffe
 #	4. classes.zip in $prefix/share/kaffe iff it exists.
 #
 
+# If KAFFE_DEBUG is set to either gdb or emacs, a debugging session
+# will be started.  gdb will be started so that the current working
+# directory and the argument list are correct.
+
 prefix="@prefix@"
 exec_prefix="@exec_prefix@"
 : ${KAFFE_BINDIR="@bindir@"}
 : ${KAFFE_CLASSDIR="@datadir@/kaffe"}
 : ${KAFFE_LIB="@libdir@"}
 CLASSPATH="${CLASSPATH-.}:$KAFFE_CLASSDIR/Klasses.jar:$KAFFE_CLASSDIR/pizza.jar"`test -f $KAFFE_CLASSDIR/classes.zip && echo ":$KAFFE_CLASSDIR/classes.zip"`
 export CLASSPATH
 LD_LIBRARY_PATH="$KAFFE_LIB"${LD_LIBRARY_PATH+":$LD_LIBRARY_PATH"}
 export LD_LIBRARY_PATH
 
-exec $KAFFE_BINDIR/Kaffe ${1+"$@"}
+if test x"${KAFFE_DEBUG+set}"x != x"set"x; then
+    exec $KAFFE_BINDIR/Kaffe ${1+"$@"}
+else
+    case `"$KAFFE_DEBUG" --version </dev/null 2>/dev/null` in
+    "GDB"*|"GNU gdb"*)
+	# start command-line gdb within the correct working directory,
+	# and set up the specified argument list
+	{
+	    echo "shell rm -f /tmp/.gdbinit.$$"
+	    echo "cd `pwd`"
+	    echo "set args $*"
+	} >/tmp/.gdbinit.$$
+	exec "$KAFFE_DEBUG" -command /tmp/.gdbinit.$$ $KAFFE_BINDIR/Kaffe
+	rm -f /tmp/.gdbinit.$$;;
+    "GNU Emacs"*)
+	# start gdb within GNU Emacs, move into the current working
+	# directory and set up the specified argument list
+	exec "$KAFFE_DEBUG" -eval "(progn (gdb \"gdb $KAFFE_BINDIR/Kaffe\") (gud-call \"cd `pwd`\") (gud-call \"set args $*\"))";;
+    XEmacs*)
+	# start gdb within XEmacs, move into the current working
+	# directory and set up the specified argument list
+	exec "$KAFFE_DEBUG" -eval "(progn (gdb \"$KAFFE_BINDIR/Kaffe\") (gdb-call \"cd `pwd`\") (gdb-call \"set args $*\"))";;
+    *) echo you must set KAFFE_DEBUG to either emacs or gdb >&2;;
+    esac
+fi
+exit 1
Index: kaffe/scripts/native2ascii
===================================================================
RCS file: /home/msc/oliva/src/.cvs/kaffe/kaffe/scripts/native2ascii,v
retrieving revision 1.1.1.3
retrieving revision 1.3
diff -u -r1.1.1.3 -r1.3
--- kaffe/scripts/native2ascii	1998/08/05 22:18:15	1.1.1.3
+++ kaffe/scripts/native2ascii	1998/09/07 19:29:46	1.3
@@ -1,2 +1,29 @@
 #! /bin/sh
-exec java sun.tools.native2ascii.Main "$@"
+runme=java
+if test x"${KAFFE_HOME+set}"x = x"set"x &&
+   test -x "$KAFFE_HOME/bin/$runme"; then
+    # use $runme from $KAFFE_HOME/bin
+    runme="$KAFFE_HOME/bin/$runme"
+else
+    # if not set or not found, use the same directory that contains
+    # this script, after following soft-links
+    file="$0"
+    while test -h "$file"; do
+	# follow soft-links.
+	# first, find out the link name, printed after ` -> ' in ls output
+	newfile=`ls -l "$file" | sed s/'.* -> '//`
+	case "$newfile" in
+	/*) # absolute link: just use it
+	    file="$newfile";;
+	*)  # relative link: concat current basedir with link
+	    file=`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'`/"$newfile";;
+	esac
+    done
+    # remove trailing slash and basename
+    # (avoid duplicated output by redirecting cd to /dev/null)
+    basedir=`cd \`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'\` >/dev/null 2>&1; pwd`
+    # if $runme exists in basedir, use it
+    if test -x "$basedir/$runme"; then runme="$basedir/$runme"; fi
+    # otherwise, it will be searched in the PATH...
+fi
+exec "$runme" sun.tools.native2ascii.Main ${1+"$@"}
Index: kaffe/scripts/pizza
===================================================================
RCS file: /home/msc/oliva/src/.cvs/kaffe/kaffe/scripts/pizza,v
retrieving revision 1.1.1.2
retrieving revision 1.3
diff -u -r1.1.1.2 -r1.3
--- kaffe/scripts/pizza	1998/08/05 22:18:17	1.1.1.2
+++ kaffe/scripts/pizza	1998/09/07 19:29:46	1.3
@@ -1,3 +1,30 @@
 #! /bin/sh
 # Script to run Pizza Java compiler
-exec kaffe pizza.compiler.Main "$@"
+runme=kaffe
+if test x"${KAFFE_HOME+set}"x = x"set"x &&
+   test -x "$KAFFE_HOME/bin/$runme"; then
+    # use $runme from $KAFFE_HOME/bin
+    runme="$KAFFE_HOME/bin/$runme"
+else
+    # if not set or not found, use the same directory that contains
+    # this script, after following soft-links
+    file="$0"
+    while test -h "$file"; do
+	# follow soft-links.
+	# first, find out the link name, printed after ` -> ' in ls output
+	newfile=`ls -l "$file" | sed s/'.* -> '//`
+	case "$newfile" in
+	/*) # absolute link: just use it
+	    file="$newfile";;
+	*)  # relative link: concat current basedir with link
+	    file=`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'`/"$newfile";;
+	esac
+    done
+    # remove trailing slash and basename
+    # (avoid duplicated output by redirecting cd to /dev/null)
+    basedir=`cd \`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'\` >/dev/null 2>&1; pwd`
+    # if $runme exists in basedir, use it
+    if test -x "$basedir/$runme"; then runme="$basedir/$runme"; fi
+    # otherwise, it will be searched in the PATH...
+fi
+exec "$runme" pizza.compiler.Main ${1+"$@"}
Index: kaffe/scripts/pizzadoc
===================================================================
RCS file: /home/msc/oliva/src/.cvs/kaffe/kaffe/scripts/pizzadoc,v
retrieving revision 1.1.1.2
retrieving revision 1.3
diff -u -r1.1.1.2 -r1.3
--- kaffe/scripts/pizzadoc	1998/08/05 22:18:18	1.1.1.2
+++ kaffe/scripts/pizzadoc	1998/09/07 19:29:47	1.3
@@ -1,3 +1,30 @@
 #! /bin/sh
 # Script to run PizzaDoc
-exec kaffe pizza.compiler.Main -pizzadoc "$@"
+runme=kaffe
+if test x"${KAFFE_HOME+set}"x = x"set"x &&
+   test -x "$KAFFE_HOME/bin/$runme"; then
+    # use $runme from $KAFFE_HOME/bin
+    runme="$KAFFE_HOME/bin/$runme"
+else
+    # if not set or not found, use the same directory that contains
+    # this script, after following soft-links
+    file="$0"
+    while test -h "$file"; do
+	# follow soft-links.
+	# first, find out the link name, printed after ` -> ' in ls output
+	newfile=`ls -l "$file" | sed s/'.* -> '//`
+	case "$newfile" in
+	/*) # absolute link: just use it
+	    file="$newfile";;
+	*)  # relative link: concat current basedir with link
+	    file=`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'`/"$newfile";;
+	esac
+    done
+    # remove trailing slash and basename
+    # (avoid duplicated output by redirecting cd to /dev/null)
+    basedir=`cd \`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'\` >/dev/null 2>&1; pwd`
+    # if $runme exists in basedir, use it
+    if test -x "$basedir/$runme"; then runme="$basedir/$runme"; fi
+    # otherwise, it will be searched in the PATH...
+fi
+exec "$runme" pizza.compiler.Main -pizzadoc ${1+"$@"}
Index: kaffe/scripts/rmic
===================================================================
RCS file: /home/msc/oliva/src/.cvs/kaffe/kaffe/scripts/rmic,v
retrieving revision 1.1.1.3
retrieving revision 1.3
diff -u -r1.1.1.3 -r1.3
--- kaffe/scripts/rmic	1998/08/05 22:18:22	1.1.1.3
+++ kaffe/scripts/rmic	1998/09/07 19:29:47	1.3
@@ -1,2 +1,29 @@
 #! /bin/sh
-exec java sun.rmi.rmic.Main "$@"
+runme=java
+if test x"${KAFFE_HOME+set}"x = x"set"x &&
+   test -x "$KAFFE_HOME/bin/$runme"; then
+    # use $runme from $KAFFE_HOME/bin
+    runme="$KAFFE_HOME/bin/$runme"
+else
+    # if not set or not found, use the same directory that contains
+    # this script, after following soft-links
+    file="$0"
+    while test -h "$file"; do
+	# follow soft-links.
+	# first, find out the link name, printed after ` -> ' in ls output
+	newfile=`ls -l "$file" | sed s/'.* -> '//`
+	case "$newfile" in
+	/*) # absolute link: just use it
+	    file="$newfile";;
+	*)  # relative link: concat current basedir with link
+	    file=`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'`/"$newfile";;
+	esac
+    done
+    # remove trailing slash and basename
+    # (avoid duplicated output by redirecting cd to /dev/null)
+    basedir=`cd \`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'\` >/dev/null 2>&1; pwd`
+    # if $runme exists in basedir, use it
+    if test -x "$basedir/$runme"; then runme="$basedir/$runme"; fi
+    # otherwise, it will be searched in the PATH...
+fi
+exec "$runme" sun.rmi.rmic.Main ${1+"$@"}
Index: kaffe/scripts/rmiregistry
===================================================================
RCS file: /home/msc/oliva/src/.cvs/kaffe/kaffe/scripts/rmiregistry,v
retrieving revision 1.1.1.3
retrieving revision 1.3
diff -u -r1.1.1.3 -r1.3
--- kaffe/scripts/rmiregistry	1998/08/05 22:18:20	1.1.1.3
+++ kaffe/scripts/rmiregistry	1998/09/07 19:29:47	1.3
@@ -1,2 +1,29 @@
 #! /bin/sh
-exec java sun.rmi.registry.RegistryImpl "$@"
+runme=java
+if test x"${KAFFE_HOME+set}"x = x"set"x &&
+   test -x "$KAFFE_HOME/bin/$runme"; then
+    # use $runme from $KAFFE_HOME/bin
+    runme="$KAFFE_HOME/bin/$runme"
+else
+    # if not set or not found, use the same directory that contains
+    # this script, after following soft-links
+    file="$0"
+    while test -h "$file"; do
+	# follow soft-links.
+	# first, find out the link name, printed after ` -> ' in ls output
+	newfile=`ls -l "$file" | sed s/'.* -> '//`
+	case "$newfile" in
+	/*) # absolute link: just use it
+	    file="$newfile";;
+	*)  # relative link: concat current basedir with link
+	    file=`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'`/"$newfile";;
+	esac
+    done
+    # remove trailing slash and basename
+    # (avoid duplicated output by redirecting cd to /dev/null)
+    basedir=`cd \`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'\` >/dev/null 2>&1; pwd`
+    # if $runme exists in basedir, use it
+    if test -x "$basedir/$runme"; then runme="$basedir/$runme"; fi
+    # otherwise, it will be searched in the PATH...
+fi
+exec "$runme" sun.rmi.registry.RegistryImpl ${1+"$@"}
Index: kaffe/scripts/serialver
===================================================================
RCS file: /home/msc/oliva/src/.cvs/kaffe/kaffe/scripts/serialver,v
retrieving revision 1.1.1.3
retrieving revision 1.3
diff -u -r1.1.1.3 -r1.3
--- kaffe/scripts/serialver	1998/08/05 22:18:24	1.1.1.3
+++ kaffe/scripts/serialver	1998/09/07 19:29:48	1.3
@@ -1,2 +1,29 @@
 #! /bin/sh
-exec java sun.tools.serialver.SerialVer "$@"
+runme=java
+if test x"${KAFFE_HOME+set}"x = x"set"x &&
+   test -x "$KAFFE_HOME/bin/$runme"; then
+    # use $runme from $KAFFE_HOME/bin
+    runme="$KAFFE_HOME/bin/$runme"
+else
+    # if not set or not found, use the same directory that contains
+    # this script, after following soft-links
+    file="$0"
+    while test -h "$file"; do
+	# follow soft-links.
+	# first, find out the link name, printed after ` -> ' in ls output
+	newfile=`ls -l "$file" | sed s/'.* -> '//`
+	case "$newfile" in
+	/*) # absolute link: just use it
+	    file="$newfile";;
+	*)  # relative link: concat current basedir with link
+	    file=`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'`/"$newfile";;
+	esac
+    done
+    # remove trailing slash and basename
+    # (avoid duplicated output by redirecting cd to /dev/null)
+    basedir=`cd \`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'\` >/dev/null 2>&1; pwd`
+    # if $runme exists in basedir, use it
+    if test -x "$basedir/$runme"; then runme="$basedir/$runme"; fi
+    # otherwise, it will be searched in the PATH...
+fi
+exec "$runme" sun.tools.serialver.SerialVer ${1+"$@"}
Index: kaffe/scripts/compat/appletviewer
===================================================================
RCS file: /home/msc/oliva/src/.cvs/kaffe/kaffe/scripts/compat/appletviewer,v
retrieving revision 1.1.1.3
retrieving revision 1.4
diff -u -r1.1.1.3 -r1.4
--- kaffe/scripts/compat/appletviewer	1998/09/07 17:18:07	1.1.1.3
+++ kaffe/scripts/compat/appletviewer	1998/09/07 19:29:56	1.4
@@ -1,3 +1,30 @@
 #! /bin/sh
 # Script to run Appletviewer
-exec kaffe kaffe.applet.AppletViewer "$@"
+runme=kaffe
+if test x"${KAFFE_HOME+set}"x = x"set"x &&
+   test -x "$KAFFE_HOME/bin/$runme"; then
+    # use $runme from $KAFFE_HOME/bin
+    runme="$KAFFE_HOME/bin/$runme"
+else
+    # if not set or not found, use the same directory that contains
+    # this script, after following soft-links
+    file="$0"
+    while test -h "$file"; do
+	# follow soft-links.
+	# first, find out the link name, printed after ` -> ' in ls output
+	newfile=`ls -l "$file" | sed s/'.* -> '//`
+	case "$newfile" in
+	/*) # absolute link: just use it
+	    file="$newfile";;
+	*)  # relative link: concat current basedir with link
+	    file=`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'`/"$newfile";;
+	esac
+    done
+    # remove trailing slash and basename
+    # (avoid duplicated output by redirecting cd to /dev/null)
+    basedir=`cd \`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'\` >/dev/null 2>&1; pwd`
+    # if $runme exists in basedir, use it
+    if test -x "$basedir/$runme"; then runme="$basedir/$runme"; fi
+    # otherwise, it will be searched in the PATH...
+fi
+exec "$runme" kaffe.applet.AppletViewer ${1+"$@"}
Index: kaffe/scripts/compat/java
===================================================================
RCS file: /home/msc/oliva/src/.cvs/kaffe/kaffe/scripts/compat/java,v
retrieving revision 1.1.1.2
retrieving revision 1.3
diff -u -r1.1.1.2 -r1.3
--- kaffe/scripts/compat/java	1998/08/05 22:18:30	1.1.1.2
+++ kaffe/scripts/compat/java	1998/09/07 19:29:57	1.3
@@ -1,3 +1,30 @@
 #! /bin/sh
 # Pretend Kaffe is Java
-exec kaffe "$@"
+runme=kaffe
+if test x"${KAFFE_HOME+set}"x = x"set"x &&
+   test -x "$KAFFE_HOME/bin/$runme"; then
+    # use $runme from $KAFFE_HOME/bin
+    runme="$KAFFE_HOME/bin/$runme"
+else
+    # if not set or not found, use the same directory that contains
+    # this script, after following soft-links
+    file="$0"
+    while test -h "$file"; do
+	# follow soft-links.
+	# first, find out the link name, printed after ` -> ' in ls output
+	newfile=`ls -l "$file" | sed s/'.* -> '//`
+	case "$newfile" in
+	/*) # absolute link: just use it
+	    file="$newfile";;
+	*)  # relative link: concat current basedir with link
+	    file=`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'`/"$newfile";;
+	esac
+    done
+    # remove trailing slash and basename
+    # (avoid duplicated output by redirecting cd to /dev/null)
+    basedir=`cd \`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'\` >/dev/null 2>&1; pwd`
+    # if $runme exists in basedir, use it
+    if test -x "$basedir/$runme"; then runme="$basedir/$runme"; fi
+    # otherwise, it will be searched in the PATH...
+fi
+exec "$runme" ${1+"$@"}
Index: kaffe/scripts/compat/javac
===================================================================
RCS file: /home/msc/oliva/src/.cvs/kaffe/kaffe/scripts/compat/javac,v
retrieving revision 1.1.1.2
retrieving revision 1.3
diff -u -r1.1.1.2 -r1.3
--- kaffe/scripts/compat/javac	1998/08/05 22:18:32	1.1.1.2
+++ kaffe/scripts/compat/javac	1998/09/07 19:29:57	1.3
@@ -1,3 +1,30 @@
 #! /bin/sh
 # We use Pizza compiler rather than Sun's.
-exec kaffe pizza.compiler.Main "$@"
+runme=kaffe
+if test x"${KAFFE_HOME+set}"x = x"set"x &&
+   test -x "$KAFFE_HOME/bin/$runme"; then
+    # use $runme from $KAFFE_HOME/bin
+    runme="$KAFFE_HOME/bin/$runme"
+else
+    # if not set or not found, use the same directory that contains
+    # this script, after following soft-links
+    file="$0"
+    while test -h "$file"; do
+	# follow soft-links.
+	# first, find out the link name, printed after ` -> ' in ls output
+	newfile=`ls -l "$file" | sed s/'.* -> '//`
+	case "$newfile" in
+	/*) # absolute link: just use it
+	    file="$newfile";;
+	*)  # relative link: concat current basedir with link
+	    file=`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'`/"$newfile";;
+	esac
+    done
+    # remove trailing slash and basename
+    # (avoid duplicated output by redirecting cd to /dev/null)
+    basedir=`cd \`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'\` >/dev/null 2>&1; pwd`
+    # if $runme exists in basedir, use it
+    if test -x "$basedir/$runme"; then runme="$basedir/$runme"; fi
+    # otherwise, it will be searched in the PATH...
+fi
+exec "$runme" pizza.compiler.Main ${1+"$@"}
Index: kaffe/scripts/compat/javadoc
===================================================================
RCS file: /home/msc/oliva/src/.cvs/kaffe/kaffe/scripts/compat/javadoc,v
retrieving revision 1.1.1.2
retrieving revision 1.3
diff -u -r1.1.1.2 -r1.3
--- kaffe/scripts/compat/javadoc	1998/08/05 22:18:33	1.1.1.2
+++ kaffe/scripts/compat/javadoc	1998/09/07 19:29:57	1.3
@@ -1,3 +1,30 @@
 #! /bin/sh
 # We use Pizza rather than Sun's
-exec kaffe pizza.compiler.Main -pizzadoc "$@"
+runme=kaffe
+if test x"${KAFFE_HOME+set}"x = x"set"x &&
+   test -x "$KAFFE_HOME/bin/$runme"; then
+    # use $runme from $KAFFE_HOME/bin
+    runme="$KAFFE_HOME/bin/$runme"
+else
+    # if not set or not found, use the same directory that contains
+    # this script, after following soft-links
+    file="$0"
+    while test -h "$file"; do
+	# follow soft-links.
+	# first, find out the link name, printed after ` -> ' in ls output
+	newfile=`ls -l "$file" | sed s/'.* -> '//`
+	case "$newfile" in
+	/*) # absolute link: just use it
+	    file="$newfile";;
+	*)  # relative link: concat current basedir with link
+	    file=`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'`/"$newfile";;
+	esac
+    done
+    # remove trailing slash and basename
+    # (avoid duplicated output by redirecting cd to /dev/null)
+    basedir=`cd \`echo "$file" | sed 's%/[^/]*$%%;s/^$/./'\` >/dev/null 2>&1; pwd`
+    # if $runme exists in basedir, use it
+    if test -x "$basedir/$runme"; then runme="$basedir/$runme"; fi
+    # otherwise, it will be searched in the PATH...
+fi
+exec "$runme" pizza.compiler.Main -pizzadoc ${1+"$@"}

--Multipart_Wed_Sep__9_03:07:03_1998-1--


--GAB14380.905331925/grande.dcc.unicamp.br--





More information about the kaffe mailing list