#!/bin/ash
#
#
#
 case "$1" in
 'add')
 echo "513 stream tcp nowait root rlogin.d" > /etc/inetd/rlogin.conf
 ;;
 'start')
 rlogind add
 inetd
 ;;
 'remove')
 rm /etc/inetd/rlogin.conf 2>/dev/null
 ;;
 'stop')
 rlogind remove
 inetd
 ;;
 'restart')
 rlogind start
 ;;
 'test')
 if [ ! -e /etc/inetd/rlogin.conf ]; then
   echo "Your rlogin server seems to be down."
   read -p "Do you wish to start it now (y/n)?: " CHOICE
   CHOICE=y$CHOICE
   if [ $CHOICE = yy ]; then
     rlogind start
   fi
 fi
 clear
 echo "NetKit rlogin Client will try to connect to your localhost:"
 rlogin localhost
 ;;
 'help')
 echo "rlogind start --> start rlogin server"
 echo "rlogind stop --> stop rlogin server"
 echo "rlogind restart --> restart rlogin server"
 echo "rlogind test --> test rlogin server"
 ;;
 *)
 echo "Usage:"
 rlogind help
 ;;
 esac