Cover V04, I02
Article
Listing 1
Listing 2
Listing 3
Sidebar 1
Sidebar 2

mar95.tar


Listing 2: The duptty script

#!/bin/ksh
# written by Steve Peterson, 11-94.
if (($# != 4))
then
echo 'usage: duptty old_tty_nm new_tty_nm sa_nm w_num'
echo 'example: duplicate tty161'
echo '   at serial adapter 12, connection 2'
echo '   and call it tty901...'
echo '         duptty 161 901 sa12 2'
exit
fi
otty=tty$1
ntty=tty$2
sa=$3    # serial adapter name
w=$4     # connection number

lsattr -El $otty >/tmp/t1.$$
lsattr -Dl $otty >/tmp/t2.$$
diff -b /tmp/t1.$$ /tmp/t2.$$ | awk '
BEGIN {print "mkdev -p",sa,"-w",w,"-c tty -t tty -s rs232 \\"}
{if ($1 == "<") print "-a "$2"="$3" \\"}
END {print "-l "ntty}
' otty=$otty ntty=$ntty sa=$sa w=$w >/tmp/t3.$$
ksh /tmp/t3.$$
/usr/bin/rm /tmp/t[123].$$