ref: 1ca868f1913c0dc61beef0d27490253f095ad495
parent: f6dbc2ae6e153c5608b6f9d893238d71ae521935
author: Sigrid Solveig Haflínudóttir <[email protected]>
date: Fri Oct 8 13:47:29 EDT 2021
add gridup
--- a/README.md
+++ b/README.md
@@ -12,6 +12,7 @@
* `xml.[ch]` XML parser, works as a streaming parser as well
* `clear` removes all program output from the terminal, leaving only commands used
+* `gridup` connects to 9p.zone, mounts stuff from its registry and starts chat windows
* `helpmeport` generates files needed to port a Unix library or a binary
* `watch` watch-like tool, imagine
* `st-xx-lha-convert` extract `*.lha` archives and convert samples to WAV, on UNIX
--- /dev/null
+++ b/gridup
@@ -1,0 +1,46 @@
+#!/bin/rc
+
+srv tcp!registry.9p.zone!6675 registry /n/registry
+
+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
+cd /tmp/chatnicks/$chan && rm -f *
+{
+ mkdir -p /tmp/chatnicks/$chan && \
+ cd /tmp/chatnicks/$chan && \
+ rm -f *
+ awk '/^[-a-zA-Z_0-9]+ [→•|] / { system("touch " $1 ":") }' </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 -cd /tmp/chatnicks/$c /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