ref: e5c7367c265358d21e2268c7e54f3340d1d3998b
dir: /chat/
#!/bin/rc user=be0ba fn chatg{ label chatg grep -i '[^a-z0-9]'$user'([^a-z0-9]|$)' /n/chatbuf/chat | grep -v '^'$user' →' | chat-fmt } fn chati{ label chati while(){ echo -n '→ ' >> /dev/text read | sed '1s/^/'$user' → /' >>/n/chat/chat } } fn chatv{ label chatv </n/chatbuf/chat chat-fmt } fn chatstart{ srv tcp!chat.tcp80.org!9990 chat.$pid mount /srv/chat.$pid /n/chat tail:0 dims=`{read -c60 /dev/window} height=`{echo $dims(5) - $dims(3) | hoc} width=`{echo $dims(4) - $dims(2)| hoc} hchat=`{echo $height - 200 | hoc} mq -c -m /n/chatbuf -s mq.$pid cat /n/chat/chat > /n/chatbuf/chat & window -m -r 0 0 $width 100 -scroll rc -c chatg window -m -r 0 100 $width $hchat -scroll rc -c chatv window -m -r 0 $hchat $width $height -scroll rc -c chati } rfork ne window 0,0,620,1033 rio -b -i 'rc -c chatstart'