trcmain - plan9port - [fork] Plan 9 from user space
 (HTM) git clone git://src.adamsgaard.dk/plan9port
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       trcmain (1041B)
       ---
            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 }
           12 if(~ $rcname ?.out ?.rc */?.rc */?.out) prompt=('broken! ' '        ')
           13 if(flag p) path=(/bin /usr/bin)
           14 if not{
           15         finit
           16         # should be taken care of by rc now, but leave just in case
           17 }
           18 fn sigexit
           19 if(! ~ $#cflag 0){
           20         if(flag l && test -r $home/lib/profile) . $home/lib/profile
           21         status=''
           22         eval $cflag
           23         exit $status
           24 }
           25 if(flag i){
           26         if(~ $termprog 9term || ~ $termprog win){
           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
           37         }
           38         if(flag l && test -r $home/lib/profile) . $home/lib/profile
           39         status=''
           40         if(! ~ $#* 0) . $*
           41         . -i '/dev/stdin'
           42         exit $status
           43 }
           44 if(flag l && test -r $home/lib/profile) . $home/lib/profile
           45 if(~ $#* 0){
           46         . /dev/stdin
           47         exit $status
           48 }
           49 status=''
           50 . $*
           51 exit $status