Plan 9 from Bell Labs’s /usr/web/sources/contrib/nemo/octopus/port/dis/o/termrc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


#!/dis/sh.dis -n

# Start script for octopus terminal

load std
echo 1 >/dev/jit
sysname=`{cat /dev/sysname}
user=`{cat /dev/user}

ndb/dns
ndb/cs

if { ~ $#location 0 } {
	echo -n 'location? [home] '
	location=`{read}
}
if { ~ $#location 0 } {
	location=home
}
if { ~ $#PC 0 } {
	echo -n 'PC? [alboran.lsub.org] '
	PC=`{read}
}
if { ~ $#PC 0 } {
	PC=alboran.lsub.org
}
pcip=`{ndb/dnsquery $PC | sed 's/.*ip	//'}
grep -v '^sys=pc' /lib/ndb/octopus > /lib/ndb/_octopus
echo 'sys=pc ip='^$pcip >>/lib/ndb/_octopus
mv /lib/ndb/_octopus /lib/ndb/octopus

echo welcome to your octopus terminal at $location
echo PC is $PC $pcip

# /what /who /fs
#
mkdir -p /term /term/what /term/who /term/fs
mkdir -p /term/what/$sysname
mkdir -p /term/who/$user
bind -c '#U*' /term/fs
mkdir -p /pc
echo $location > /term/what/$sysname/where
echo $location > /term/who/$user/where
echo $user >/term/what/$sysname/owner
echo 0 >/term/what/$sysname/radius

# terminal devices and services
#
echo starting local services
bind -a '#C' /
bind -ac /dis/o/$emuhost /dis/o
rm -f /tmp/view.* /tmp/print.*
o/spool -m /term/view o/view &
o/spool -m /term/print o/print &
o/voice -m /term/voice &
test -x /dis/o/$emuhost/termrc && /dis/o/$emuhost/termrc

echo 'exporting /what /who /fs'
o/oxport -x tcp!pc!rop /term &
o/netget what 'path /what' who 'path /who' fs 'path /fs' &

# if { ~ $location home } { while {;} {echo $location >/pc/usr/$user/lib/octopuslogin; sleep 30 } & }
echo 'importing /pc'
mount -c tcp!pc!styx /n/pc
bind -c /n/pc/mnt/registry /mnt/registry
mkdir -p /tmp/cache
o/ofs -c /tmp/cache -m /pc tcp!pc!op
bind -c /devs /devs
bind -ac /pc/devs /devs
radius=`{time ls -ld /pc/lib/ndb >/dev/null |[2] sed -e 's/.* //' -e 's/\.//' -e 's/t//'}
echo $radius > /term/what/$sysname/radius
echo terminal with radius $radius
bind -c /term /pc/devs/$sysname	# shortcut and avoid deadlocks


# This shell has the namespace of the octopus terminal
font=/fonts/charon/plain.normal.font
plumber
o/plumbing view { cp $msg /term/view }
acme -f $font /pc
wm/sh

echo welcome to your octopus terminal at $location
echo PC is $PC $pcip
test -f /term/voice/speak && { echo greetings professor $user >/term/voice/speak }
test -f /term/voice/speak && { echo welcome to your octopus terminal at $location >/term/voice/speak }
load expr
test -f /term/voice/speak && {echo radius is ${expr $radius 0 +} milliseconds from the PC >/term/voice/speak }

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.