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
This commit is contained in:
cinap_lenrek 2016-12-03 00:24:19 +01:00
parent 9a55346264
commit 978628d679

View file

@ -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]
}