rsc | 1379cec | 2003-11-23 18:29:41 +0000 | [diff] [blame] | 1 | # rcmain: Plan 9 on Unix version |
| 2 | if(~ $#home 0) home=$HOME |
| 3 | if(~ $#home 0) home=/ |
| 4 | if(~ $#ifs 0) ifs=' |
| 5 | ' |
| 6 | switch($#prompt){ |
| 7 | case 0 |
| 8 | prompt=('% ' ' ') |
| 9 | case 1 |
| 10 | prompt=($prompt ' ') |
| 11 | } |
rsc | 2774920 | 2004-03-26 17:31:41 +0000 | [diff] [blame] | 12 | if(~ $rcname ?.out ?.rc */?.rc */?.out) prompt=('broken! ' ' ') |
rsc | f1bfc54 | 2004-05-14 17:45:39 +0000 | [diff] [blame] | 13 | if(flag p) path=(/bin /usr/bin) |
rsc | 1379cec | 2003-11-23 18:29:41 +0000 | [diff] [blame] | 14 | if not{ |
| 15 | finit |
rsc | c8b6342 | 2005-01-13 04:49:19 +0000 | [diff] [blame] | 16 | # should be taken care of by rc now, but leave just in case |
rsc | 1379cec | 2003-11-23 18:29:41 +0000 | [diff] [blame] | 17 | } |
| 18 | fn sigexit |
| 19 | if(! ~ $#cflag 0){ |
rsc | cb27443 | 2004-03-25 23:03:22 +0000 | [diff] [blame] | 20 | if(flag l && test -r $home/lib/profile) . $home/lib/profile |
rsc | 1379cec | 2003-11-23 18:29:41 +0000 | [diff] [blame] | 21 | status='' |
| 22 | eval $cflag |
rsc | a5a494c | 2005-03-18 19:50:15 +0000 | [diff] [blame] | 23 | exit $status |
rsc | 1379cec | 2003-11-23 18:29:41 +0000 | [diff] [blame] | 24 | } |
rsc | a5a494c | 2005-03-18 19:50:15 +0000 | [diff] [blame] | 25 | if(flag i){ |
Steve McCoy | 1889a25 | 2013-08-13 12:46:38 -0400 | [diff] [blame] | 26 | if(~ $termprog 9term || ~ $termprog win){ |
rsc | 3f056d8 | 2005-08-10 16:59:19 +0000 | [diff] [blame] | 27 | 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 |
rsc | 5a82f26 | 2003-12-02 22:03:35 +0000 | [diff] [blame] | 37 | } |
rsc | f1bfc54 | 2004-05-14 17:45:39 +0000 | [diff] [blame] | 38 | if(flag l && test -r $home/lib/profile) . $home/lib/profile |
rsc | 1379cec | 2003-11-23 18:29:41 +0000 | [diff] [blame] | 39 | status='' |
| 40 | if(! ~ $#* 0) . $* |
| 41 | . -i '/dev/stdin' |
rsc | a5a494c | 2005-03-18 19:50:15 +0000 | [diff] [blame] | 42 | exit $status |
rsc | 1379cec | 2003-11-23 18:29:41 +0000 | [diff] [blame] | 43 | } |
rsc | a5a494c | 2005-03-18 19:50:15 +0000 | [diff] [blame] | 44 | if(flag l && test -r $home/lib/profile) . $home/lib/profile |
| 45 | if(~ $#* 0){ |
| 46 | . /dev/stdin |
| 47 | exit $status |
rsc | 1379cec | 2003-11-23 18:29:41 +0000 | [diff] [blame] | 48 | } |
rsc | a5a494c | 2005-03-18 19:50:15 +0000 | [diff] [blame] | 49 | status='' |
| 50 | . $* |
rsc | 1379cec | 2003-11-23 18:29:41 +0000 | [diff] [blame] | 51 | exit $status |