#!/bin/sh -e

# null modem getty

# phone cable connection:
# other computer issues ATX1D1 first
# then we answer with ATA to establish connection

# serial null modem data cable connection:
# better handled by S0:12:respawn:/sbin/agetty 115200 ttyS0 ansi
# in /etc/inittab

MODEM=${1-modem}

exec <&- >&- 2>&- 
exec < /dev/$MODEM > /dev/$MODEM

# case $MODEM in
# modem) chat '' ATZ 'OK-+++\c-OK' ATZ OK ATA 00;;
# serial) ;;
# esac

export TERM=ansi
stty sane rows 24 cols 80
exec 2>&1
clear
cd

case $UID in

# 0*) exec intr mingetty $MODEM;;
# ?*) exec intr su - $USER;;
0|"") exec intr agetty 115200 $MODEM ansi;;
???*) exec intr bash --login;;
esac
