:
# startapplet - starts "appletviewer" with Java applet
# Heiner Steven (heiner.steven@odn.de), 10/96

PN=`basename "$0"`

# The HTML stub should be in the current directory. The applet
# then can use "Applet.getDocumentBase()" to determine the current
# directory
HtmlStub=htmlstub.$$

trap 'rm -f "$HtmlStub" >/dev/null 2>&1' 0
trap "exit 2" 1 2 3 13 15

for AppletName
do
    case "$AppletName" in
	*.java) Base=`basename "$AppletName" .java`;;
	*)	 Base="$AppletName";;
    esac
    Applet="$Base.class"
    cat <<-! > $HtmlStub
	<APPLET code="$Applet" width=450 height=300>
	</APPLET>
	!

    appletviewer "$HtmlStub" ||
	echo >&2 "$PN: appletviewer returned $?"
done
exit 0
