Skip to content

Commit

Permalink
rc: import latest from 9front
Browse files Browse the repository at this point in the history
Includes work to increase portability on *nix systems by cinap_lenrek,
some extensions to the syntax, and multiple bug fixes to:
 - lexer/interpreter
 - globber
 - heredoc
and much more.
  • Loading branch information
grobe0ba committed Aug 2, 2022
1 parent 964ac74 commit 4a4ebef
Show file tree
Hide file tree
Showing 33 changed files with 3,716 additions and 3,002 deletions.
47 changes: 17 additions & 30 deletions rcmain
Original file line number Diff line number Diff line change
@@ -1,51 +1,38 @@
# rcmain: Plan 9 on Unix version
# rcmain: unix version
if(~ $#home 0) home=$HOME
if(~ $#home 0) home=/
if(~ $#ifs 0) ifs='
'
profile=$home/.rcrc
switch($#prompt){
case 0
prompt=('% ' ' ')
case 1
prompt=($prompt ' ')
}
if(~ $rcname ?.out ?.rc */?.rc */?.out) prompt=('broken! ' ' ')
if(flag p) path=(/bin /usr/bin)
if not{
if(~ $rcname ?.out) prompt=('broken! ' ' ')
if(flag p) path=/bin
if not {
finit
# should be taken care of by rc now, but leave just in case
if(~ $#path 0) path=(. /bin /usr/bin /usr/local/bin)
}
fn sigexit
if(! ~ $#cflag 0){
if(flag l && test -r $home/lib/profile) . $home/lib/profile
if(flag l) {
. -q $profile
}
status=''
eval $cflag
exit $status
}
if(flag i){
if(~ $termprog 9term || ~ $termprog win){
fn cd {
# builtin cd $1 && flag i && awd
# is not sufficient when running in a subshell
# that is rc -e (like mk uses!)
if(builtin cd $1){
if(flag i) $PLAN9/bin/9 awd || status=''
status=''
}
}
$PLAN9/bin/9 awd
if not if(flag i){
if(flag l) {
. -q $profile
}
if(flag l && test -r $home/lib/profile) . $home/lib/profile
status=''
if(! ~ $#* 0) . $*
. -i '/dev/stdin'
exit $status
. -i /dev/fd/0
}
if(flag l && test -r $home/lib/profile) . $home/lib/profile
if(~ $#* 0){
. /dev/stdin
exit $status
if not if(~ $#* 0) . /dev/fd/0
if not{
status=''
. $*
}
status=''
. $*
exit $status
Loading

0 comments on commit 4a4ebef

Please sign in to comment.