:
#	@(#) ttyupd 23.4 91/10/28 
#
#	Copyright (C) 1990-1991 The Santa Cruz Operation, Inc.
#		All Rights Reserved.
#	The information in this file is provided for the exclusive use of
#	the licensees of The Santa Cruz Operation, Inc.  Such users have the
#	right to use, modify, and incorporate this code into other products
#	for purposes authorized by the license agreement provided they include
#	this notice and the associated copyright notice with any such product.
#	The information in this file is provided "AS IS" without warranty.
#
# This script attempts to create Terminal Control database entries
# for terminals present in the inittab file but not entered in the
# Terminal Control database.

[ -f /tmp/ttyschk.$$ ] && {
    rm -f /tmp/ttyschk.$$
}

id |
awk '{
    split($0, ARR,"(")
    print "%s", ARR[1]
} ' > /tmp/ttyschk.$$ 

cut -f2 -d"=" < /tmp/ttyschk.$$ > /tmp/ttyschk
for i in `cat /tmp/ttyschk`
do
    [ "$i" -eq 0 ] && {
	[ -f /etc/auth/system/ttys ] || {
            cps /etc/auth/system/ttys
	}
    }
done

rm -f /tmp/ttyschk /tmp/ttyschk.$$ 2>&1 > /dev/null

/tcb/bin/ale /etc/auth/system/ttys termupd
