~aleteoryx/ntalk

ref: 69a3bf456744cedb7b86573b8b2c2cf9354ab796 ntalk/9talk/log -rwxr-xr-x 452 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
31
32
33
#!/bin/rc

if(~ $#* 0){
	addr='tcp!localhost!44322'
}
if not if(! ~ $#* 1){
	echo 'usage: 9talk/log [addr]' >[1=2]
	exit usage
}
if not
	addr=$"1

buffile=.ncbuf$pid

fn onecmd{
	cmd=$"*
	{echo $"cmd; echo QUIT} | aux/dial -e $addr
}
fn linecmd{
	onecmd $"* >$buffile
	count=`{read -n 1 $buffile}
	msgid=`{tail -1 $buffile}
	if(! ~ 0 $count)
		tail +2 $buffile | read -n $count
	rm $buffile
}

linecmd LAST 16

while(){
	sleep 5
	linecmd SKIP $msgid
}