#ident "@(#)/usr/local/sysadmin/TTYMGR 1.0 03/14/91" Author: Mr Reinhard Pfaffinger
# Office: 1924 CSS/SDA, Randolph AFB, Texas 78150
# Phone: AV 487-8649  Comm: (512) 652-8649
#
# This script allows a system administrator to view and modify tty settings.
#

chkfortty() {
             if [ "$TERM" = "tty" ]
               then
                   echo  
             else
                 tput clear 
             fi
            }

while :
 do
   chkfortty
   echo "                    <<< AT&T 3B2/600G TTY Management Menu >>>\n"
   echo "                        1. View TTY Line Settings (EPORTS, FXM)"
   echo "                        2. Modify TTY Line Settings (EPORTS, FXM)"
   echo "                        3. View /etc/inittab File"
   echo "                        4. View /etc/gettydefs File"
   echo "                        5. View Active GETTY Processes\n"
   echo "                        q or Q to quit\n"
   echo "                        Enter response <RETURN> =>> \c"
   read RESP
   case "$RESP" in
      1)
        chkfortty
        sysadm ttymgmt/lineset
        continue
        ;;
      2)
        chkfortty
        sysadm ttymgmt/modtty
        continue
        ;;
      3)
        chkfortty
        pg -n20 -p"Press <RETURN> to continue; q or Q to quit ... " /etc/inittab
        continue
        ;;
      4)
        chkfortty
        pg -n20 -p"Press <RETURN> to continue; q or Q to quit ... " /etc/gettydefs
        continue
        ;;
      5)
        chkfortty
        echo "The following GETTY processes are:\n"
        ps -ef | fgrep getty | fgrep -v "fgrep getty" | pg -n20 -p"Press <RETURN> to continue; q or Q to quit ... "
        continue
        ;;
    q|Q)
        exit 0
        ;;
      *)
        echo "\n\t\t\t\tInvalid response!\c"
        sleep 2
        continue
        ;;
   esac
 done
