From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: To: 9fans@cse.psu.edu Subject: Re: [9fans] /net like file trees and scripting. From: "Russ Cox" MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Date: Wed, 2 Oct 2002 22:18:46 -0400 Topicbox-Message-UUID: fbdcc796-eaca-11e9-9e20-41e7f4b1d025 here's rlogin. #!/bin/rc # produce a zero byte on stdout fn zero { dd -if /dev/zero -count 1 -bs 1 >[2]/dev/null } # translate a network address fn cslookup { echo $1 | ndb/csquery >[2]/dev/null |tr -d '>' } # translate the network address for rlogin x=`{cslookup net!$1!login} if(~ $#x 0){ echo couldn''t translate $1 exit 'unknown host' } clonefile=$x(1) dialstring=$x(2) # hold the clone file open to keep the connection ours <[4] $clonefile { netdir=`{basename -d $clonefile} ^ / ^ `{cat /fd/4} # write connect string to /net/tcp/N/ctl echo connect $dialstring >$netdir/ctl || exit 'cannot connect' # proxy data from remote system cat $netdir/data | tr -d '' & # must do bsd authentication protocol at beginning. { zero && echo -n $user # local user && zero && echo -n $user # remote user && zero && echo -n p9 # terminal type && zero } >$netdir/data || exit 'cannot talk bsd' # proxy data to remote system from keyboard # hold /dev/cons open to keep raw mode on /dev/consctl { echo rawon cat >$netdir/data } }