#!/bin/sh

# Set these to the path to NFSD on your system; the default arguments
# to run p3nfsd with; and the mount directory you use for it.
P3NFSD=/home/mwm/src/p3nfs/50/nfsd/p3nfsd 
DEFAULT="-shell $SHELL -"
MNTDIR=/psion/mnt

# For debugging purposes
#ECHO=echo

if test $# -eq 0
then
	$ECHO $P3NFSD $DEFAULT
	exit
fi

COMMAND=$1
shift
case $COMMAND in
    start) $ECHO $P3NFSD $DEFAULT "$@" ;;
    raw) $ECHO $P3NFSD "$@" ;;
	# The manual recommends "ls" for these, but that touches debug twice
	# on my systems. Cat doesn't have that problem.
    exit) cat $MNTDIR/exit >/dev/null 2>&1 ;;
    debug) cat $MNTDIR/debug >/dev/null 2>&1 ;;
    *|help)
	echo This is a front end for p3nfs. The first argument is a word
	echo telling it what you want to 'do:'
	echo "	<no arguments>: start p3nfsd with the default arguments."
	echo "	raw: run p3nfsd with provided arguments."
	echo "	start: run p3nfsd with default and provided arguments."
	echo "	exit: exit the running p3nfsd."
	echo "	debug: raise the value of p3nfsd's debug variable by 1."
	echo "" 
	echo -n "Options for "
	$P3NFSD -help ;;
esac
