#!/bin/sh
#	ppp  --  Shell script that allows you to start and stop ppp conns.
#

if [ "`whoami`" != "root" ]; then
	echo "You must be root to modify ppp connections."
	exit 1;
fi

if [ "$#" = "1" -a "$1" = "list" ]; then
	echo "Available PPP hosts:"
	(cd /etc/ppp/hosts ; /bin/ls -d *);
fi

if [ "$#" != "2" ]; then
	echo "Usage: $0 {list, host {up,down,status}}"
	exit 1;
fi

if [ ! -d "/etc/ppp/hosts/$1" ]; then
	echo "${1}: No such PPP host";
	exit 1;
fi

COMM=/etc/ppp/commandHost

case "$2" in
	up)
		${COMM} "$1" up 
		;;
	down)
		${COMM} "$1" down
		;;
	status)
		${COMM} "$1" status
		;;
	*)
		echo "Usage: $0 host {up,down,status}"
		exit 1;
esac


