ref: 5b157ef7f3765b046962046cd503885c0106fd97
parent: 5a6a10aba73281e44d2553cfcbce7ff40a581e00
author: kvik <kvik@a-b.xyz>
date: Thu Jun 4 20:11:45 EDT 2020
Get rid of ornamentation eatplumb(1) * removed startup message, * removed brackets around the plumb port, * removed prefixed asterisk, * first whitespace-separated field is the port, the rest of the line is the plumb data. plumbreport(1) * removed command line argument * read stdin; output to stdout. To run a plumbreport gridservice following conventions du jour this can be run (provided the the grid plumber and grid chat are mounted in the namespace): plumbreport | awk '{printf( plumb-🤖 ⎙ [%s] %s\n , $1, $2);}' >/n/chat/chat
diff -u a/bin/plumbreport b/bin/plumbreport
--- a/bin/plumbreport
+++ b/bin/plumbreport
@@ -1,10 +1,4 @@
#!/bin/rc -e
-rfork
-out=$1
-if(~ $#out 0)
- out=/fd/1
-for(p in `{@{cd /mnt/plumb; ls}}){
- if(! ~ $p (send rules)){
- exec eatplumb $p >>$out &
- }
-}
+rfork se
+for(p in `{@{cd /mnt/plumb; ls}})
+ if(! ~ $p (send rules)) @{exec eatplumb $p}&
--- a/bin/plumbreport
+++ b/bin/plumbreport
@@ -1,10 +1,4 @@
#!/bin/rc -e
-rfork
-out=$1
-if(~ $#out 0)
- out=/fd/1
-for(p in `{@{cd /mnt/plumb; ls}}){
- if(! ~ $p (send rules)){
- exec eatplumb $p >>$out &
- }
-}
+rfork se
+for(p in `{@{cd /mnt/plumb; ls}})
+ if(! ~ $p (send rules)) @{exec eatplumb $p}&
--- a/eatplumb.c
+++ b/eatplumb.c
@@ -25,11 +25,10 @@
if((fd = plumbopen(port, OREAD)) < 0)
sysfatal("plumbopen: %r");
- fprint(2, "listening on \"%s\"\n", port);
for(;;){
if((m = plumbrecv(fd)) == nil)
sysfatal("plumbrecv: %r");
- print("* [%s] %s\n", port, m->data);
+ print("%s %s\n", port, m->data);
plumbfree(m);
}
}