#!/bin/sh
#
# ZyXEL VoiceMailBox user interface

case $# in
    0)  fifo=`ls /usr/ZyXEL/fifo.*|head -1`
	;;

    1)	fifo=/usr/ZyXEL/fifo.$1
	;;

    *)	echo "Usage: $0 [ttySx]"
    	exit 1
esac

echo "ZyXEL VoiceMailBox user interface - Hit RETURN for MENU"
echo "Use `stty -a|grep intr|sed -e 's/.*intr = \([^;]*\).*/\1/'` to quit"

# save TTY state and set to raw mode
save_tty=`stty -g`
stty -icanon min 1

(
# tell ZyXEL about my tty name
    echo ">" `tty`

# send keyboard input to the FIFO
    cat
) >$fifo

stty $save_tty
exit 0
