123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- # rcmain
- if(~ $#home 0) home=/
- if(~ $#ifs 0) ifs='
- '
- if(~ $rcname ?.out) {
- oldprompt=$prompt
- prompt=('broken! ' ' ')
- }
- if not {
- if (~ $#oldprompt 1 2)
- prompt=$oldprompt
- switch($#prompt){
- case 0
- prompt=('% ' ' ')
- case 1
- prompt=($prompt ' ')
- }
- }
- if(flag p) path=/bin
- if not{
- finit # import functions from env
- if(~ $#path 0) path=(. /bin)
- }
- fn sigexit
- fn rclogin {
- if(flag l) {
- if(! ~ $service rx && test ! -f /_fs_main)
- cat /cfg/$sysname/warning >[2]/dev/null
- if(/bin/test -r $home/lib/profile)
- . $home/lib/profile
- }
- status=''
- }
- if(! ~ $#cflag 0){ # rc -c cmd
- rclogin
- fn rclogin
- eval $cflag
- }
- if not if(flag i){ # interactive shell
- rclogin
- fn rclogin
- if(! ~ $#* 0)
- . $* # source any arguments
- . -i '#d/0' # read stdin interactively
- }
- # else non-interactive use
- if not if(~ $#* 0) {
- fn rclogin
- . '#d/0' # read stdin non-interactively
- }
- if not{
- status=''
- fn rclogin
- . $* # source any arguments
- }
- exit $status
|