blob: 461cb3eca055861ce5861acc99db930f43a76f1b [file] [log] [blame]
rsc1379cec2003-11-23 18:29:41 +00001# rcmain: Plan 9 on Unix version
2if(~ $#home 0) home=$HOME
3if(~ $#home 0) home=/
4if(~ $#ifs 0) ifs='
5'
6switch($#prompt){
7case 0
8 prompt=('% ' ' ')
9case 1
10 prompt=($prompt ' ')
11}
rsc27749202004-03-26 17:31:41 +000012if(~ $rcname ?.out ?.rc */?.rc */?.out) prompt=('broken! ' ' ')
rscf1bfc542004-05-14 17:45:39 +000013if(flag p) path=(/bin /usr/bin)
rsc1379cec2003-11-23 18:29:41 +000014if not{
15 finit
rscc8b63422005-01-13 04:49:19 +000016 # should be taken care of by rc now, but leave just in case
rsc1379cec2003-11-23 18:29:41 +000017}
18fn sigexit
19if(! ~ $#cflag 0){
rsccb274432004-03-25 23:03:22 +000020 if(flag l && test -r $home/lib/profile) . $home/lib/profile
rsc1379cec2003-11-23 18:29:41 +000021 status=''
22 eval $cflag
rsca5a494c2005-03-18 19:50:15 +000023 exit $status
rsc1379cec2003-11-23 18:29:41 +000024}
rsca5a494c2005-03-18 19:50:15 +000025if(flag i){
Steve McCoy1889a252013-08-13 12:46:38 -040026 if(~ $termprog 9term || ~ $termprog win){
rsc3f056d82005-08-10 16:59:19 +000027 fn cd {
28 # builtin cd $1 && flag i && awd
29 # is not sufficient when running in a subshell
30 # that is rc -e (like mk uses!)
31 if(builtin cd $1){
32 if(flag i) $PLAN9/bin/9 awd || status=''
33 status=''
34 }
35 }
36 $PLAN9/bin/9 awd
rsc5a82f262003-12-02 22:03:35 +000037 }
rscf1bfc542004-05-14 17:45:39 +000038 if(flag l && test -r $home/lib/profile) . $home/lib/profile
rsc1379cec2003-11-23 18:29:41 +000039 status=''
40 if(! ~ $#* 0) . $*
41 . -i '/dev/stdin'
rsca5a494c2005-03-18 19:50:15 +000042 exit $status
rsc1379cec2003-11-23 18:29:41 +000043}
rsca5a494c2005-03-18 19:50:15 +000044if(flag l && test -r $home/lib/profile) . $home/lib/profile
45if(~ $#* 0){
46 . /dev/stdin
47 exit $status
rsc1379cec2003-11-23 18:29:41 +000048}
rsca5a494c2005-03-18 19:50:15 +000049status=''
50. $*
rsc1379cec2003-11-23 18:29:41 +000051exit $status