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

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


if (! test -e '#c')
	service = unix

iroot = /sys/inferno
if (! test -e $iroot)
	iroot = /opt/inferno

if (! ~ $service unix) {
	path=(/bin .) # safer than the default
	bind -a $iroot/Plan9/$cputype/bin /bin
	bind -b $home/bin/$cputype /bin
	bind -b $home/bin/rc /bin
	bind -a /acme/bin /bin
	bind -c $home/tmp /tmp
	[email protected]
}

font=/lib/font/bit/lucida/unicode.7.font
rwin = /mnt/term/mnt/wsys
tabstop = 4

fn	:	{}
fn	lf	{ls -Fp $* | mc}
fn	ll	{ls -lp $*}
fn	lart	{ls -lrt $*}
fn	lsbig	{ls -l $* | sort -nb +5}
fn	lsd	{ls -F $* | grep '/\''?$' | mc}
fn	RAMFS	{ramfs -s ; mount -c /srv/ramfs /tmp}

fn	initprog	{
	echo -n 'Start [r]io, [n]ile, [a]cme, [rc], [c]pu, [o]ther:'
	profilestart=`{read}
	switch($profilestart){
	case r
		#pipefile -r ktrans /dev/cons
		rio -s -f $font -i /bin/riostart #</dev/cons
	case n
		nile -m -f $font -i /bin/riostart
#		# experimental multi-workspace thingie from yiyus
#		fn newwin {window -minx 100 -miny 60 $*}
#		nrio -s -f $font -I -i lib/wins/nrio
	case a
		acmestart
	case c
		cpu
	case rc
		;
	case *
		#pipefile -r ktrans /dev/cons
		rio -s -f $font #-i $home/lib/wins #</dev/cons
	}
}

if (test -e $rwin)
	service=cpu

µblog=http://identi.ca/api	# microblogging on plan 9!
EMU='-g1000x700'

switch($service){
case terminal
#	RAMFS # zachias doesn't have nearly the ram for this
# why not from the kernel? eg 9vx
	if (! test -e /mnt/factotum/ctl)
		auth/factotum -a root.9srv.net
	#feedkeys
# The srvfs, rfork, and mount lines let plumber make global changes to /n.
	srvfs plumbspace /n
	if (~ $terminal 'vx32 9vx')
		plumber -p $home/lib/plumbing.9vx
	if not
		plumber
	rfork n
	mount -b /srv/plumbspace /n
	if (! test -r /mail/box/$user/mbox)
		importupas
	if not
		upas/fs
	echo -n accelerated > '#m/mousectl' >[2]/dev/null
	echo -n 'res 3' > '#m/mousectl' >[2]/dev/null
	prompt=(':; ' '	')
	initprog
case cpu
	if (test -e $rwin/wctl) {
		# rio already running
		wsys = /mnt/term^`{cat /mnt/term/env/wsys}
		bind -a $rwin /dev
		if (test -e /dev/label) {
			echo -n $sysname > /dev/label
		}
	}
	bind /mnt/term/dev/cons /dev/cons
	bind /mnt/term/dev/consctl /dev/consctl
	bind -a /mnt/term/dev /dev
	prompt=(': '$sysname'; ' '	')
	if (grep -sv '^$' /mnt/term/mnt/factotum/ctl >[2] /dev/null)
		bind /mnt/term/mnt/factotum /mnt/factotum
	if (! test -e $rwin) {
		# cpu call from drawterm
		font=/lib/font/bit/pelm/unicode.8.font
		cd
		plumber
		if (test -e /mnt/term/dev/secstore) {
			auth/factotum -n
			cat /mnt/term/dev/secstore | read -m > /mnt/factotum/ctl
		}
		if not
			auth/factotum
		upas/fs
		initprog
	}
	if not {
#		upas/fs
		news
	}
case con
	prompt=(':; ' '	')
	news
case unix
	SYSHOST=`{uname | sed '
		s;Darwin;MacOSX;;'}
	cputype=`{uname -m | sed '
		s;i.86;386;;
		s;x86_64;amd64;;
		s;/.*;;;
		s; ;;g;
		s;armv4l;arm;g;
		s;PowerMacintosh;power;g;
		s;macppc;power;g;
		s;ppc64;power;g;
		s;ppc;power;g'}

	LC_CTYPE=en_US.UTF-8
	LANG=en_US.UTF-8
	EDITOR=E
	PAGER=nobs
	BROWSER=safari
	stty erase '^H' >[2] /dev/null

	if (~ $cputype amd64)
		inf_bin = $iroot/$SYSHOST/386/bin
	if not
		inf_bin = $iroog/$SYSHOST/$cputype/bin

	optpkgs = (go MacPorts v6shell asterisk libixp dmenu svn mercurial)
	packages = (/usr/X11R6 /opt/$optpkgs)
	path = (. $home/bin/unix $home/bin/$SYSHOST/$cputype /usr/bin /usr/sbin /bin /sbin \
		$packages/bin $PLAN9/bin $inf_bin)
	if (~ $cputype amd64)
		path = ($path $home/bin/$SYSHOST/386)

	GOBIN=$home/bin/$SYSHOST/$cputype
	GOPATH=$home/src/go
	PYTHONPATH=/opt/mercurial/lib/python2.5/site-packages

	font = `{echo $font | 9 sed 's!^/lib/font/bit!'$PLAN9'/font!; s!lucida!luc!'}
	if (~ $DISPLAY '')
		DISPLAY=:0
	if (! test -e `{namespace})
		plumber
	if (~ $sysname '')
		sysname=`{hostname -s}
	prompt=(': '$sysname'; ' '	')
}

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].