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 | cb27443 | 2004-03-25 23:03:22 +0000 | [diff] [blame] | 13 | if(flag p) path=(/bin) |
rsc | 1379cec | 2003-11-23 18:29:41 +0000 | [diff] [blame] | 14 | if not{ |
| 15 | finit |
rsc | cb27443 | 2004-03-25 23:03:22 +0000 | [diff] [blame] | 16 | if(~ $#path 0) { |
| 17 | path=(/bin /usr/bin) |
| 18 | . <{sh -c 'echo $PATH | |
rsc | 1379cec | 2003-11-23 18:29:41 +0000 | [diff] [blame] | 19 | sed "s/^/path=(''/; s/$/'')/; s/:/'' ''/g"'} |
rsc | cb27443 | 2004-03-25 23:03:22 +0000 | [diff] [blame] | 20 | } |
rsc | 1379cec | 2003-11-23 18:29:41 +0000 | [diff] [blame] | 21 | } |
| 22 | fn sigexit |
| 23 | if(! ~ $#cflag 0){ |
rsc | cb27443 | 2004-03-25 23:03:22 +0000 | [diff] [blame] | 24 | if(flag l && test -r $home/lib/profile) . $home/lib/profile |
rsc | 1379cec | 2003-11-23 18:29:41 +0000 | [diff] [blame] | 25 | status='' |
| 26 | eval $cflag |
| 27 | } |
| 28 | if not if(flag i){ |
rsc | 5a82f26 | 2003-12-02 22:03:35 +0000 | [diff] [blame] | 29 | if(~ $TERM 9term){ |
rsc | 5a82f26 | 2003-12-02 22:03:35 +0000 | [diff] [blame] | 30 | if(~ $#'fn#cd' 0) |
| 31 | fn cd { builtin cd $1 && label `{pwd} } |
| 32 | } |
rsc | 1379cec | 2003-11-23 18:29:41 +0000 | [diff] [blame] | 33 | if(flag l && /bin/test -r $home/lib/profile) . $home/lib/profile |
| 34 | status='' |
| 35 | if(! ~ $#* 0) . $* |
| 36 | . -i '/dev/stdin' |
| 37 | } |
| 38 | if not if(~ $#* 0) . '/dev/stdin' |
| 39 | if not{ |
| 40 | status='' |
| 41 | . $* |
| 42 | } |
| 43 | exit $status |