#ident	"@(#)bnu:modem	1.1"

if [ ! -f /etc/uucp/Devices.bak ]
then
	mv /etc/uucp/Devices /etc/uucp/Devices.bak
	if [ $? -ne 0 ]
	then
		echo "save of Devices failed. you must be root"
		exit 1
	fi
fi

if [ $# -ne 2 ]
then
	echo "usage: $0 device speed"
	exit 1
fi

case $2 in 
	'300'| '1200'| '2400'| '4800'| '9600'| '19200'| '38400')
		;;
	'14400')
		$2=19200
		;;
	'28800')
		$2=38400
		;;
	*)
		echo "bad speed usage: $0 device 300|1200|2400|4800|9600|14400|19200|28800|38400"
		exit 1
esac


case "$1" in
   'com1')
	DEVICE=/dev/tty00h
	;;
   'com2')
	DEVICE=/dev/tty01h
	;;
   'com3')
	DEVICE=/dev/tty02h
	;;
   'com4')
	DEVICE=/dev/tty03h
	;;
    *)
	DEVICE=$1
	;;
esac

echo "Direct $DEVICE,M - $2 direct_modem" > /etc/uucp/Devices
cu -l $DEVICE

mv /etc/uucp/Devices.bak /etc/uucp/Devices
if [ $? -ne 0 ]
then
	echo "restore of Devices failed. Please restore the /etc/uucp/Devices file with the Dialup Setup GUI"
	exit 1
fi

