AIX 3.1: Ugly kludge to allow bi-directional use of a serial port

Warren Jones golder at nwnexus.WA.COM
Wed Sep 5 08:40:53 AEST 1990


#! /bin/sh
#
# Kermit:
#
#   This is an ugly kludge to allow bi-direction use of a serial port
#   under AIX 3.1.  Pshare and pdelay are suppose to accomplish this,
#   but do not work.
#           
#   We have just one modem, attached to /dev/tty1.  If a user is calling
#   in on this port, the script just exec's the "real" kermit (re-named
#   to wermit).
#
#   If a user is trying to call out, check to see if tty1 is already
#   in use.  If not, disable the port, change permissions to allow
#   reading and writing, then start the real kermit.  After kermit
#   exits, re-enable the port for login.

PATH=/bin:/usr/bin:/etc:/usr/local/bin
export PATH

LINE=/dev/tty1                      # This is our only modem port.

test `tty` = $LINE && exec wermit   # No conflicts.

if test -f /etc/locks/LCK..$LINE || ps -t 1 > /dev/null
then
    echo Sorry, $LINE is already in use.
    exit 0
fi

pdisable $LINE
chtty               # Make tty readable/writable.
wermit              # The "real" kermit.
penable $LINE

# Complete source for "chtty":
#
# /* Make this program suid root. */.
# main() { return system( "/bin/chmod og+rw /dev/tty1" ); }

-- 
----------------------------------------------------------------
Warren Jones <golder at nwnexus.wa.com>      Golder Associates Inc.
(uucp: uunet!nwnexus!golder)              4104 148th Avenue NE
(206) 883-0777                            Redmond, WA 98052, USA



More information about the Comp.unix.aix mailing list