Plan 9 from Bell Labs’s /usr/web/sources/contrib/rsc/profile

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


# bin
bind -b $home/bin/$cputype /bin
bind -b $home/bin/rc /bin
if(test -d /usr/inferno/Inferno/386/bin)
	bind -a /usr/inferno/Inferno/386/bin /bin
if(test -d /usr/inferno/Plan9/386/bin)
	bind -a /usr/inferno/Plan9/386/bin /bin

facedom=astro
weather=bos
tz=US_Eastern
wisconsin=no

cp /adm/timezone/$tz /env/timezone

# if(~ $service rx)
# 	exit ''



if(~ $#sysname 0)
	sysname=gnot

# where are we?
ipaddr=`{netstat -i | sed 1q | awk '{print $3}'}
if(! ~ $#ipaddr 1)
	ipaddr=none

if(~ $service terminal && test -d /mnt/term/dev)
	service=cpu

switch($service) {
case terminal
	if(test -f '#P/apm')
		aux/apm
	switch($ipaddr) {
	case none
		;
	case *
		if(test -f /n/other/rsc/fact.keys)
			read -m /n/other/rsc/fact.keys >/mnt/factotum/ctl
		if(~ `{wc -l </mnt/factotum/ctl} 0)
			auth/secstore -G factotum | aux/lines >/mnt/factotum/ctl
	}
}

# mount some file systems
switch($service.$ipaddr) {
case *.none
	;
case terminal.135.104.9.*
	srv -m emelie emelie /n/emelie
	9fs emelieother
	9fs alice
	9fs nslocum
case terminal.135.207.*.*
#	recover -e tcp!10.252.0.122 emelie /n/emelie
	9fs eecs
	9fs cs121
case terminal.140.247.*.*
	srvemelie
	9fs emelie
	9fs eecs
	9fs cs121
case terminal.135.104.*.*
#	recover emelie emelie /n/emelie
	9fs emelieother
	9fs eecs
	9fs cs121
case terminal.18.24.*.*
	9fs ny
	bind -c /n/ny/home/ny3/rsc /usr/rsc/lcs
}

# tmp
fileserver=`{cat /env/fileserver}		# not sure why this is needed
switch($fileserver){
case emelie fs
	9fs other
	bind -c /n/other/rsc/tmp /tmp
case kfs
	9fs kfs
	bind -c /n/kfs/rsc/tmp /tmp
case *
	ramfs
}

# time
switch($sysname){
case 17genr
	kill timesync|rc
	aux/timesync -n plan9.bell-labs.com
}

# faces
bind -b /usr/rsc/lib/face /lib/face/48x48x4

# troff -mpm
bind -a /usr/rsc/lib/tmac /sys/lib/tmac

# mail
mail=/mail/box/$user
ihome=/usr/inferno/usr/rsc
# fn z { ls -lt $mail/mbox $mail/^(render risks)^/mbox /mail/box/9trouble/mbox }
fn z { ls -lt $mail/mbox /mail/box/9trouble/mbox }

# imported goods
switch($ipaddr){
case 135.104.*.*
	;
case none
	;
case 140.247.*.* 135.207.*.*
	bind -c /n/emelie/$mail $mail
	bind /dev/null $mail/mbox
#	bind -c /n/emelie/sys/src /sys/src
	bind -c /usr/rsc /usr/rsc
	bind -a /n/emelie/usr/rsc /usr/rsc
	bind -c /usr /usr
	bind -a /n/emelie/usr /usr
}

# cpu
switch($ipaddr){
case 135.104.*.*
	cpu=olive
case *
	cpu='$cpu'
}

# lp
switch($sysname^'!'^$ipaddr){
case ovid!*
	LPDEST=bjc600
case *!140.247.6*.*
	LPDEST=vogon
case *!135.104.*.*
	LPDEST=u
case *
	LPDEST=unknown
}

# special characters
tab='	'
nl='
'
cr='
'

# custom cd, pwd
if(~ $service terminal)
	sys=g
if not
	sys=$sysname

pwd=`{pwd}
lwd=$pwd
ps1='% '
prompt=($sys^$ps1 $tab)
fn $sys^'%' { if(! ~ $#* 0) $* }
fn cd {
	if(! ~ $#* 0) {
		arg=$1
		switch($arg){
		case -
			arg=$lwd
		case -/*
			arg=`{echo $arg | sed 's#^-#'$lwd'#' | cleanname}
		}
	} 
	if not
		arg=()

	builtin cd $arg && {
		awd
		if(test -w /dev/label){
			if(~ $service terminal)
				echo -n `{pwd} >/dev/label
			if(~ $service cpu)
				echo -n $sysname `{pwd} >/dev/label
		}
		status=''
	}
}

# new fonts for acme
fn acme {/bin/acme -f /lib/font/bit/lucidasans/unicode.8.font $*}

fn small {
	fn acme { /bin/acme -f/lib/font/bit/lucidasans/unicode.7.font -F$font $* }
#	font=/lib/font/bit/lucidasans/typelatin1.7.font
	if(! ~ $#* 0)
		$*
}
font=/lib/font/bit/lucm/unicode.9.font

# distribution
d=/n/sources/plan9
t=/n/emelietemp/crp/sources.copy
9fs emelietemp
9fs sources
D=/n/emelietemp/testplan9

# 9pm
# bind -c /usr/rsc/9pm /9pm
# bind -a /9pm/Plan9/386/bin /bin

# CVS
EDITOR=plumbit

switch($service){
case terminal
	if(test -f /dev/mousectl){
		echo -n hwaccel off >/dev/mousectl
		echo -n accelerated 4 >/dev/mousectl
		echo -n res 3 >/dev/mousectl
	}

	# usb
	bind -a '#U' /dev >[2]/dev/null
	if(test -d /dev/usb0){
		usb/usbd
		usb/usbaudio
	}

	if(! test -f /mail/box/rsc/names && test -f /n/emelie/mail/box/rsc/names)
		bind /n/emelie/mail/box/rsc /mail/box/rsc
	plumber
	switch($ipaddr){
	case none
		;
	case 135.104.9.*
		upas/fs
	case *
		echo -n pop...
		switch($wisconsin){
		case yes
			upas/fs
		case *
			upas/fs -f/apoptls/plan9.bell-labs.com/rsc >>[2]/tmp/poplog
		}
		echo
	}
	if(~ `{screensize} small)
		small
	exec rio -i riostart

case cpu
	bind /mnt/term/dev/cons /dev/cons
	bind /mnt/term/dev/consctl /dev/consctl
	bind -a /mnt/term/dev /dev

	if (test -e /mnt/term/mnt/wsys) {
		# rio already running
		bind -a /mnt/term/mnt/wsys /dev
		if(test -w /dev/label)
			echo -n $sysname > /dev/label
		upas/fs -p
	}
	if not {	# drawterm
		plumber
		upas/fs
	}

	#fortune
	news
	if(test -f /mnt/term/env/wsys)
		wsys=/mnt/term/`{cat /mnt/term/env/wsys}

	if (! test -e /mnt/term/mnt/wsys) {
		# cpu call from drawterm
		#exec rio -i driostart
		if(~ `{screensize} small)
			small
	}
case con
	news
}

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.