shithub: riscv

Download patch

ref: 978628d67994819f0b3b9e2a0834d8941a21f6b5
parent: 9a553462646b5941e1b6e681ce22afa286e77375
author: cinap_lenrek <[email protected]>
date: Fri Dec 2 19:24:19 EST 2016

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

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