#!@POSIXSHELL@
# swbis - sw<utility> execution wrapper

# Copyright (C) 2003  Jim Lowe
#
# COPYING TERMS AND CONDITIONS:
# 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, 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.

SWBISLIBEXECDIR="/@SWBISLIBEXECDIR@/"
SWBIS_RELEASE=@SWBIS_RELEASE@
SWBIS_BINDIR="@SWBIS_BINDIR@"
		
help() {
	echo "The swbis command execution wrapper."
	echo "Usage: swbis <sw_utility> [options]"
	echo "    swbis will execute utilities located in"
	echo "    $SWBIS_BINDIR"
	echo "The following utilites are found there:"
	echo $SWBIS_BINDIR/swpackage
	echo $SWBIS_BINDIR/swinstall
	echo $SWBIS_BINDIR/swverify
	echo $SWBIS_BINDIR/swcopy
	echo $SWBIS_BINDIR/swign
	echo 
	echo Read the info docs for more info.
	echo Type:
	echo     info swbis
	echo or read man pages for each utility.
	echo 
	echo "Report bugs to <bug-swbis@gnu.org>"
}

version() {
	echo "swbis version ${SWBIS_RELEASE}"
	echo ""
	echo "Copyright (C) 2002,2003,2004,2005 Jim Lowe"
	echo "This software is distributed under the terms of the GNU General Public License"
	echo "and comes with NO WARRANTY to the extent permitted by law."
	echo "See the file named COPYING for details."
	exit 0;
}
while true ; do
	case "$1" in
		-V|--version) version; exit 0 ;;
		-\?|--help) help; exit 0 ;;
		sw*) break ;;
		-?) shift; break ;;
		--) shift; break ;;
		"") shift; break ;;
	esac
done

case "$#" in
	0)
		help 1>&2
		exit 1
		;;
esac

cmd=$1
shift
exec "$SWBIS_BINDIR"/"$cmd" "$@"
exit 1
