~aleteoryx/ntalk

ref: 69a3bf456744cedb7b86573b8b2c2cf9354ab796 ntalk/9talk/motd -rwxr-xr-x 477 bytes
69a3bf45 — glenda 9talk/motd 12 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/rc

if(! ~ 1 $#*){
	echo 'usage: 9talk/motd addr' >[1=2]
	exit usage
}

addr=$1

libdir=$home/lib/9talk
idfile=$libdir/$addr.id
motdfile=$libdir/$addr.motd
mkdir -p $libdir

if(test -r $idfile)
	cmd='SKIP '^`{cat $idfile}
if not
	cmd='HIST'

{echo $cmd; echo QUIT} | aux/dial -e $addr >.motd$pid

id=`''{tail -1 .motd$pid}
motd=`''{grep '^MOTD ' .motd$pid | tail -1 | tail +5c}
rm .motd$pid

echo -n $id>$idfile
if(! ~ $"motd '')
	echo -n $motd>$motdfile

cat $motdfile