~aleteoryx/ntalk

69a3bf456744cedb7b86573b8b2c2cf9354ab796 — glenda 12 days ago d100582 master
9talk/motd
2 files changed, 31 insertions(+), 0 deletions(-)

A 9talk/motd
M README.md
A 9talk/motd => 9talk/motd +30 -0
@@ 0,0 1,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

M README.md => README.md +1 -0
@@ 58,6 58,7 @@ consists of the following scripts:
    - '.' or ':': sends $nick $line.
    - '"' or no prefix: sends $nick: $line
- `9talk/chat`: opens a window with /log and /cmd running
- `9talk/motd addr`: checks for the most recent MOTD of $addr, and echos it. the most recent MOTD and last-seen message id are stored in $home/lib/9talk/$addr.motd and $home/lib/9talk/$addr.id, respectively.


## `scrollbackup.sh`: simple backup script