#! /bin/sh
# prefix command to run stuff from our programs directory
# Copyright (C) 1998, 1999  Henry Spencer.
# 
# 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.  See <http://www.fsf.org/copyleft/gpl.txt>.
# 
# 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.
#
# RCSID $Id: ipsec.in,v 1.7 1999/11/08 00:58:00 henry Exp $

# where the private directory is (exported in case other things want it)
IPSECDIR=/usr/local/lib/ipsec
export IPSECDIR

# standardize PATH, and export it for everything else's benefit
PATH=/usr/local/sbin:/sbin:/usr/sbin:/usr/local/bin:/bin:/usr/bin
export PATH

# things not to be listed in --help command list
DONTMENTION='^(ipsec|_.*|.*\.old)$'

# Caution:  setup knows the format of $version
version="Linux FreeS/WAN 1.3"
copyright="Copyright (C) 1999 Henry Spencer, Richard Guy Briggs, D. Hugh Redelmeier,
	Sandy Harris, Angelos D. Keromytis, John Ioannidis.

   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.  See <http://www.fsf.org/copyleft/gpl.txt>.

   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
   (file COPYING in the distribution) for more details."

case "$1" in
--help|'')
	echo "Usage: ipsec command argument ..."
	echo "where command is one of:"
	ls $IPSECDIR | egrep -v -i "$DONTMENTION" | sed 's/^/	/'
	echo
	exit 0
	;;
--version)
	echo "$version"
	echo "$copyright"
	exit 0
	;;
--*)
	echo "$0: unknown option \`$1' (perhaps command name was omitted?)" >&2
	exit 1
	;;
esac

cmd="$1"
shift
path="$IPSECDIR/$cmd"

if test ! -x "$path"
then
	echo "$0: unknown IPSEC command \`$cmd' (\`$0 --help' for list)" >&2
	exit 1
fi
$path "$@"
