ref: 78cb5f799244618f26e32961cff7f0642c1dfaab
parent: 18169a203e0505ecc1006f388eec103fd0b59d76
author: qwx <qwx@sciops.net>
date: Thu Feb 13 21:50:03 EST 2025
midipipe: add reader mode poor man's not-9p server
--- a/bin/midipipe
+++ b/bin/midipipe
@@ -1,4 +1,6 @@
#!/bin/rc
+rfork en
+
fn cleanup{
rm -f /srv/midi
}
@@ -10,10 +12,17 @@
cleanup
}
-rfork n
+r=()
+if(~ $1 -r){
+ r=1
+ shift
+}
rm -f /srv/midi
bind -a '#|' /mnt/midi
<>[3]/mnt/midi/data1 {
echo 3 >/srv/midi
- cat $* >/mnt/midi/data
+ if(! ~ $#r 0)
+ cat /mnt/midi/data
+ if not
+ cat $* >/mnt/midi/data
}