jehanne/arch/rc/lib/rcmain

35 lines
579 B
Plaintext

# rcmain: Plan 9 version
if(~ $#HOME 0) HOME=/
if(~ $#IFS 0) IFS='
'
switch($#PROMPT){
case 0
PROMPT=('% ' ' ')
case 1
PROMPT=($PROMPT ' ')
}
if(~ $rcname ?.out) PROMPT=('broken! ' ' ')
if(flag p) PATH=/cmd
if not{
finit
if(~ $#PATH 0) PATH=(/cmd .)
}
fn sigexit
if(! ~ $#rccmd 0){
if(flag l && /cmd/test -r $HOME/lib/profile) . $HOME/lib/profile
STATUS=''
eval $rccmd
}
if not if(flag i){
if(flag l && /cmd/test -r $HOME/lib/profile) . $HOME/lib/profile
STATUS=''
if(! ~ $#* 0) . $*
. -i '#d/0'
}
if not if(~ $#* 0) . '#d/0'
if not{
STATUS=''
. $*
}
exit $STATUS