shithub: snippets

ref: a1a213fab617a3f238cb2984dd0c905d45904074
dir: /gridup/

View raw version
#!/bin/rc

srv tcp!registry.9p.zone!6675 registry /n/registry
srv tcp!chat.9p.zone!9990 9p.zone.chat /n/chat.9p.zone
srv -c tcp!9p.zone!9991 9p.zone.disk /n/disk

fn clean {
	echo $1 | sed 's/.*!([^!]+)!.*/\1/'
}

for(s in /n/registry/tcp*){
	s=`{basename $s}
	srv $s `{clean $s} /n/^`{clean $s} &
}

>/tmp/chatcat cat <<'...'
#!/bin/rc
chan=$1
label $chan
echo JOIN $nick to chat >>/n/chat.9p.zone/$chan
cat /n/chat.9p.zone/$chan &
while() cat | sed '1s/^/'$nick' → /' >>/n/chat.9p.zone/$chan
...
chmod +x /tmp/chatcat

>/tmp/gridrio cat <<'...'
#!/bin/rc
for(c in chat commits noise)
	window -scroll /tmp/chatcat $c
...
chmod +x /tmp/gridrio

echo '	Type a (multi-line) message ending with a newline'
echo '	and press control-d (EOT) to send.'
echo
echo -n 'Please enter nickname to use, finish with ENTER: '
nick=`{read}
if(~ $#nick 0)
	nick=$user

exec rio -s -i /tmp/gridrio