-
Notifications
You must be signed in to change notification settings - Fork 326
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
33 changed files
with
4,554 additions
and
2,988 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
TARG=rc | ||
|
||
OFILES=\ | ||
code.o\ | ||
exec.o\ | ||
getflags.o\ | ||
glob.o\ | ||
here.o\ | ||
io.o\ | ||
lex.o\ | ||
pcmd.o\ | ||
pfnc.o\ | ||
simple.o\ | ||
subr.o\ | ||
trap.o\ | ||
tree.o\ | ||
var.o\ | ||
havefork.o\ | ||
unix.o\ | ||
syn.o\ | ||
|
||
HFILES=rc.h\ | ||
y.tab.h\ | ||
io.h\ | ||
exec.h\ | ||
fns.h\ | ||
getflags.h\ | ||
|
||
YFILES=syn.y | ||
YFLAGS=-d | ||
|
||
PREFIX=/usr/local | ||
|
||
all: $(TARG) | ||
|
||
install: $(TARG) rcmain.unix | ||
cp $(TARG) $(PREFIX)/bin/ | ||
cp rcmain.unix $(PREFIX)/lib/rcmain | ||
|
||
$(TARG): $(OFILES) | ||
$(CC) $(CFLAGS) $(LDFLAGS) -o $(TARG) $(OFILES) | ||
|
||
y.tab.h: syn.c | ||
|
||
unix.o: unix.c | ||
$(CC) $(CFLAGS) '-DPREFIX="$(PREFIX)"' -c unix.c | ||
|
||
$(OFILES): $(HFILES) | ||
|
||
clean: | ||
rm -f $(OFILES) $(TARG) syn.c y.tab.? y.debug |
Oops, something went wrong.