From 69a3bf456744cedb7b86573b8b2c2cf9354ab796 Mon Sep 17 00:00:00 2001 From: glenda Date: Wed, 26 Nov 2025 02:32:42 +0000 Subject: [PATCH] 9talk/motd --- 9talk/motd | 30 ++++++++++++++++++++++++++++++ README.md | 1 + 2 files changed, 31 insertions(+) create mode 100755 9talk/motd diff --git a/9talk/motd b/9talk/motd new file mode 100755 index 0000000000000000000000000000000000000000..f69bc0e767a2214eeed7541b823ee282a2726aed --- /dev/null +++ b/9talk/motd @@ -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 diff --git a/README.md b/README.md index 730571484ff49ca56354fdeb5d2d5f364160af6c..57e7db1c36cd954751ed92151f988e297bbf4075 100644 --- a/README.md +++ b/README.md @@ -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