diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2016-12-03 00:24:19 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2016-12-03 00:24:19 +0100 |
commit | 978628d67994819f0b3b9e2a0834d8941a21f6b5 (patch) | |
tree | 63b6e89870722189a8a549ce414cf32318ccf493 | |
parent | 9a553462646b5941e1b6e681ce22afa286e77375 (diff) | |
download | plan9front-978628d67994819f0b3b9e2a0834d8941a21f6b5.tar.xz |
tcp17019: make service proto and netdir arguments optional (for aux/listen1)
this allows /rc/bin/service/tcp17019 to be called from
aux/listen1 without arguments like:
aux/listen1 tcp!*!rcpu /rc/bin/service/tcp17019
-rwxr-xr-x | rc/bin/service/tcp17019 | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/rc/bin/service/tcp17019 b/rc/bin/service/tcp17019 index 6953f5984..0bdd5592b 100755 --- a/rc/bin/service/tcp17019 +++ b/rc/bin/service/tcp17019 @@ -1,8 +1,10 @@ #!/bin/rc -netdir=$3 -remote=$2!`{cat $3/remote} +if(~ $#* 3){ + netdir=$3 + remote=$2!`{cat $3/remote} +} fn server { - echo -n $netdir $remote >/proc/$pid/args + ~ $#remote 0 || echo -n $netdir $remote >/proc/$pid/args rm -f /env/'fn#server' . <{n=`{read} && ! ~ $#n 0 && read -c $n} >[2=1] } |