git: 9front

Download patch

ref: f027985e53ba73a0763a5eedf7489c0bca8d2760
parent: 60584e0df8f621c1470c3060ce776634a6ed01d7
author: cinap_lenrek <cinap_lenrek@felloff.net>
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]
 }
--