#!/bin/sh
# bin/shotjava -- an ITISSL program
# ITISSL - a Java 2 implementation for  Sun's reference SSL API  using SSLeay
# Copyright (C) 1999 Andrei Popovici (apopovic@iti.informatik.tu-darmstadt.de)
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#

# $Id: shotjava,v 1.2 1999/02/21 23:02:04 apopovic Exp $
#----------------------------------------------------------------------

#
# shotjava
#
# (history at end)


# SYNOPSIS
#
#  shotjava [ -sum ] <hotjava_opts>
#
# start the 'hotjava' web browser using ITISSL

usage() {
  cat <<EOF

   `basename $0` [<options>] [<hotjava args]

Options are:

   -sum                         use all certificates
   -h				show usage

EOF
}
## --------------------------------------------------
## determine location of class files and libraries
## --------------------------------------------------

bindir=`dirname $0`
if [ -d "$bindir/../classes" ]
then
    # iti or distribution, uninstalled.
     CLASSPATH="${CLASSPATH+$CLASSPATH:}$bindir/../lib/itissl/ssl.jar";
     LD_LIBRARY_PATH="${LD_LIBRARY_PATH+$LD_LIBRARY_PATH:}$bindir/../lib"
     SFINDCERTS="$bindir/sfindcerts";
else
    # installed..
    libdir=$bindir/../lib/shotjava
    LD_LIBRARY_PATH="${LD_LIBRARY_PATH+$LD_LIBRARY_PATH:}$libdir"
    CLASSPATH="${CLASSPATH+$CLASSPATH:}$libdir/ssl.jar"
    SFINDCERTS=$libdir/sfindcerts;
fi

export LD_LIBRARY_PATH CLASSPATH

## --------------------------------------------------
## parse our own options..
## --------------------------------------------------

unset sum;

while [ $# -gt 0 ]
do

  case "$1" in


    -sum)
        sum="-sum";
	;;

    -h)
        # do not exit here, allow class to show more usage info
	usage
	break
	;;

    *)
	break
	;;
  esac

  shift
done

## --------------------------------------------------
## Determine location for certs and keys
## --------------------------------------------------

CERT_FILE=`$SFINDCERTS -cert`
export KEY_FILE

KEY_FILE=`$SFINDCERTS -key`
export KEY_FILE

CA_FILE=`$SFINDCERTS -ca $sum`
export CA_FILE

if [ $sum ]
then
    trap "rm -f $CA_FILE" 0 1 2 3 15
fi

## --------------------------------------------------
## Call hotjava
## --------------------------------------------------

exec hotjava ${1+"$@"}

#======================================================================
#
# $Log: shotjava,v $
# Revision 1.2  1999/02/21 23:02:04  apopovic
# usage added
#
# Revision 1.1  1999/02/21 21:51:15  apopovic
# Initial revision
#
