shithub: rc

ref: 7c063c346a361bca2e57e26e04e8fb48a05c8c7e
dir: /bin/kx/

View raw version
#!/bin/rc -b
rfork ne
wdir=/n/ssh
fn usage{
	echo $0 >[1=2]
	exit usage
}
while(~ $1 -?){
	switch($1){
	case -r
		wdir=/n/ssh/$2
		shift
	case *
		usage
	}
	shift
}
if(! ~ $#* 1)
	usage
if(! ~ $1 tcp!*)
	m=tcp!$1!17060
. /tmp/sizes.$sysname

f=()
cat <<'!' >/tmp/work.$pid
#!/bin/rc
label kx.$pid
if(test -f $home/lib/kx){
	f=`{cat $home/lib/kx}
	eval 'f=('^$"f^')'
}
. /tmp/sizes.$sysname
window -r $bsamrect 'echo 4 >/env/tabstop; echo -n /lib/font/bit/terminus/unicode.12m.font >/env/font; jam '^$"f
!

cat <<! >/tmp/kx.$pid
#!/bin/rc
sshfs $m || exit
cd $wdir || {echo root directory $wdir does not exist >[1=2]; exit usage}
unmount /mnt/plumb
plumbsrv=()
plumber -s plumb.$pid
bof -i /tmp/work.$pid
unmount /n/ssh
unmount /mnt/plumb
rm -f /srv/plumb.$pid /tmp/kx.$pid /tmp/work.$pid
!

chmod +x /tmp/work.$pid
chmod +x /tmp/kx.$pid
window -r $briorect /tmp/kx.$pid