rc: use some uppercase variables (PATH, USER...)

This commit is contained in:
Giacomo Tesio 2017-10-22 13:22:37 +02:00
parent d6d65887b2
commit 9202b04504
26 changed files with 124 additions and 113 deletions

View File

@ -53,7 +53,7 @@ fn getwctl{
if(~ $wctl ''){ if(~ $wctl ''){
if(test -f /dev/wctl) echo /dev/wctl if(test -f /dev/wctl) echo /dev/wctl
if not if(test -f /mnt/term/dev/wctl) echo /mnt/term/dev/wctl if not if(test -f /mnt/term/dev/wctl) echo /mnt/term/dev/wctl
if not if(~ $service cpu) echo /mnt/term/srv/riowctl.*.* if not if(~ $SERVICE cpu) echo /mnt/term/srv/riowctl.*.*
if not { if not {
echo window: '$wctl' not defined >[1=2] echo window: '$wctl' not defined >[1=2]
exit usage exit usage

View File

@ -1,7 +1,7 @@
#!/cmd/rc #!/cmd/rc
rfork e rfork e
ifs=' IFS='
' '
for(i in `{ls /dev/wsys}) { for(i in `{ls /dev/wsys}) {

View File

@ -31,9 +31,9 @@ if(~ $#* 0){
# set up any fs(3) partitions # set up any fs(3) partitions
if (! test -e /dev/fs/ctl && test -e '#k/fs') if (! test -e /dev/fs/ctl && test -e '#k/fs')
bind -b '#k' /dev bind -b '#k' /dev
if (~ $#sysname 1 && ! ~ $sysname '' && if (~ $#SYSNAME 1 && ! ~ $SYSNAME '' &&
test -r /cfg/$sysname/fsconfig && test -w /dev/fs/ctl) test -r /cfg/$SYSNAME/fsconfig && test -w /dev/fs/ctl)
awk '{print $0; fflush}' /cfg/$sysname/fsconfig >/dev/fs/ctl awk '{print $0; fflush}' /cfg/$SYSNAME/fsconfig >/dev/fs/ctl
} }
if not { if not {
for(disk) { for(disk) {

View File

@ -11,7 +11,7 @@ while (! ~ $#* 0 && ~ $1 -*) {
# this is a huge difference in drawterm. # this is a huge difference in drawterm.
switch($#*){ switch($#*){
case 0 case 0
ps $flags | sed -n '/^'$user' /p' ps $flags | sed -n '/^'$USER' /p'
case 1 case 1
ps $flags | sed -n '/^'$1' /p' ps $flags | sed -n '/^'$1' /p'
case * case *

View File

@ -1,34 +1,34 @@
# rcmain: Plan 9 version # rcmain: Plan 9 version
if(~ $#home 0) home=/ if(~ $#HOME 0) HOME=/
if(~ $#ifs 0) ifs=' if(~ $#IFS 0) IFS='
' '
switch($#prompt){ switch($#PROMPT){
case 0 case 0
prompt=('% ' ' ') PROMPT=('% ' ' ')
case 1 case 1
prompt=($prompt ' ') PROMPT=($PROMPT ' ')
} }
if(~ $rcname ?.out) prompt=('broken! ' ' ') if(~ $rcname ?.out) PROMPT=('broken! ' ' ')
if(flag p) path=/cmd if(flag p) PATH=/cmd
if not{ if not{
finit finit
if(~ $#path 0) path=(/cmd .) if(~ $#PATH 0) PATH=(/cmd .)
} }
fn sigexit fn sigexit
if(! ~ $#rccmd 0){ if(! ~ $#rccmd 0){
if(flag l && /cmd/test -r $home/lib/profile) . $home/lib/profile if(flag l && /cmd/test -r $HOME/lib/profile) . $HOME/lib/profile
status='' STATUS=''
eval $rccmd eval $rccmd
} }
if not if(flag i){ if not if(flag i){
if(flag l && /cmd/test -r $home/lib/profile) . $home/lib/profile if(flag l && /cmd/test -r $HOME/lib/profile) . $HOME/lib/profile
status='' STATUS=''
if(! ~ $#* 0) . $* if(! ~ $#* 0) . $*
. -i '#d/0' . -i '#d/0'
} }
if not if(~ $#* 0) . '#d/0' if not if(~ $#* 0) . '#d/0'
if not{ if not{
status='' STATUS=''
. $* . $*
} }
exit $status exit $STATUS

View File

@ -7,7 +7,7 @@ mntgen -s slashn && chmod 666 /srv/slashn
# name translation, cs sets /dev/sysname # name translation, cs sets /dev/sysname
ndb/cs ndb/cs
sysname=`{cat /dev/sysname} SYSNAME=`{cat /dev/sysname}
# parallelism for mk # parallelism for mk
NPROC = `{wc -l </dev/sysstat} NPROC = `{wc -l </dev/sysstat}
@ -16,15 +16,15 @@ NPROC = `{wc -l </dev/sysstat}
if(test -e /arch/rc/cmd/cpurc.local) if(test -e /arch/rc/cmd/cpurc.local)
. /arch/rc/cmd/cpurc.local . /arch/rc/cmd/cpurc.local
if (~ $#sysname 0 || ~ $sysname '') { if (~ $#SYSNAME 0 || ~ $SYSNAME '') {
sysname = jehanne # default SYSNAME = jehanne # default
echo -n $sysname >/dev/sysname echo -n $SYSNAME >/dev/sysname
} }
prompt=($sysname^'# ' ' ') PROMPT=($SYSNAME^'# ' ' ')
# cpu-specific startup # cpu-specific startup
if(test -e /cfg/$sysname/cpurc) if(test -e /cfg/$SYSNAME/cpurc)
. /cfg/$sysname/cpurc . /cfg/$SYSNAME/cpurc
# start up internet if we don't already have an address # start up internet if we don't already have an address
if(! grep u /net/ipselftab | grep -sv 127.0.0.1) if(! grep u /net/ipselftab | grep -sv 127.0.0.1)
@ -69,8 +69,8 @@ if(! netstat -n | grep -s 'tcp.*Listen.* (7|9|21|22|23|25|110|113|565|993|17007|
#} #}
# cpu-specific late startup # cpu-specific late startup
if(test -e /cfg/$sysname/cpustart) if(test -e /cfg/$SYSNAME/cpustart)
. /cfg/$sysname/cpustart . /cfg/$SYSNAME/cpustart
# mode of /proc/*/ctl is inherited across rfork, and sets modes on # mode of /proc/*/ctl is inherited across rfork, and sets modes on
# other /proc files, such as note, so let listen be killed. # other /proc files, such as note, so let listen be killed.
@ -83,5 +83,5 @@ if(test ! -e '#s/comconsole')
echo 'key proto=p9sk1 dom=jehanne user=glenda !password=demodemo' >/mnt/factotum/ctl echo 'key proto=p9sk1 dom=jehanne user=glenda !password=demodemo' >/mnt/factotum/ctl
ip/listen1 -t tcp!*!17010 /cmd/cpu -R & ip/listen1 -t tcp!*!17010 /cmd/cpu -R &
# echo `{date} $sysname >>/sys/log/boot # echo `{date} $SYSNAME >>/sys/log/boot
exit '' exit ''

View File

@ -27,15 +27,15 @@ if(test -e /arch/rc/cmd/termrc.local)
# cs sets sysname (termrc.local may already have started it so check) # cs sets sysname (termrc.local may already have started it so check)
if(! test -e /srv/cs && ! test -e /net/cs) if(! test -e /srv/cs && ! test -e /net/cs)
ndb/cs -f $NDBFILE ndb/cs -f $NDBFILE
sysname=`{cat /dev/sysname} SYSNAME=`{cat /dev/sysname}
if (~ $#sysname 0 || ~ $sysname '') { if (~ $#SYSNAME 0 || ~ $SYSNAME '') {
sysname = jehanne # default SYSNAME = jehanne # default
echo -n $sysname >/dev/sysname echo -n $SYSNAME >/dev/sysname
} }
# machine specific startup (e.g., for devices not probed) # machine specific startup (e.g., for devices not probed)
if(test -e /cfg/$sysname/termrc) if(test -e /cfg/$SYSNAME/termrc)
. /cfg/$sysname/termrc . /cfg/$SYSNAME/termrc
# start IP on the LAN, if not already configured. diskless terminals # start IP on the LAN, if not already configured. diskless terminals
# are already configured by now. It's commented out to avoid a long timeout # are already configured by now. It's commented out to avoid a long timeout
@ -46,7 +46,7 @@ if(test -e /cfg/$sysname/termrc)
#if(! test -e /net/ipifc/0/ctl) #if(! test -e /net/ipifc/0/ctl)
# ip/ipconfig # ip/ipconfig
# #
# Otherwise, see /cfg/$sysname/termrc (/cfg/example/termrc is an example). # Otherwise, see /cfg/$SYSNAME/termrc (/cfg/example/termrc is an example).
# start dns if we have an internet # start dns if we have an internet
if(test -e /net/ipifc/0/ctl && ! test -e /srv/dns) if(test -e /net/ipifc/0/ctl && ! test -e /srv/dns)

View File

@ -7,7 +7,7 @@ mntgen -s slashn && chmod 666 /srv/slashn
# name translation, cs sets /dev/sysname # name translation, cs sets /dev/sysname
ndb/cs ndb/cs
sysname=`{cat /dev/sysname} SYSNAME=`{cat /dev/sysname}
# parallelism for mk # parallelism for mk
NPROC = `{wc -l </dev/sysstat} NPROC = `{wc -l </dev/sysstat}
@ -16,15 +16,15 @@ NPROC = `{wc -l </dev/sysstat}
if(test -e /arch/rc/cmd/cpurc.local) if(test -e /arch/rc/cmd/cpurc.local)
. /arch/rc/cmd/cpurc.local . /arch/rc/cmd/cpurc.local
if (~ $#sysname 0 || ~ $sysname '') { if (~ $#SYSNAME 0 || ~ $SYSNAME '') {
sysname = jehanne # default SYSNAME = jehanne # default
echo -n $sysname >/dev/sysname echo -n $SYSNAME >/dev/sysname
} }
prompt=($sysname^'# ' ' ') PROMPT=($SYSNAME^'# ' ' ')
# cpu-specific startup # cpu-specific startup
if(test -e /cfg/$sysname/cpurc) if(test -e /cfg/$SYSNAME/cpurc)
. /cfg/$sysname/cpurc . /cfg/$SYSNAME/cpurc
# start up internet if we don't already have an address # start up internet if we don't already have an address
if(! grep u /net/ipselftab | grep -sv 127.0.0.1) if(! grep u /net/ipselftab | grep -sv 127.0.0.1)
@ -69,8 +69,8 @@ if(! netstat -n | grep -s 'tcp.*Listen.* (7|9|21|22|23|25|110|113|565|993|17007|
#} #}
# cpu-specific late startup # cpu-specific late startup
if(test -e /cfg/$sysname/cpustart) if(test -e /cfg/$SYSNAME/cpustart)
. /cfg/$sysname/cpustart . /cfg/$SYSNAME/cpustart
# mode of /proc/*/ctl is inherited across rfork, and sets modes on # mode of /proc/*/ctl is inherited across rfork, and sets modes on
# other /proc files, such as note, so let listen be killed. # other /proc files, such as note, so let listen be killed.
@ -83,5 +83,5 @@ if(test ! -e '#s/comconsole')
echo 'key proto=p9sk1 dom=jehanne user=glenda !password=demodemo' >/mnt/factotum/ctl echo 'key proto=p9sk1 dom=jehanne user=glenda !password=demodemo' >/mnt/factotum/ctl
ip/listen1 -t tcp!*!17010 /cmd/cpu -R & ip/listen1 -t tcp!*!17010 /cmd/cpu -R &
# echo `{date} $sysname >>/sys/log/boot # echo `{date} $SYSNAME >>/sys/log/boot
exit '' exit ''

View File

@ -29,7 +29,7 @@ mount -a /boot /cmd
mount -a /srv/factotum /mnt mount -a /srv/factotum /mnt
# standard bin # standard bin
bind /arch/$cputype/cmd /cmd bind /arch/$CPUTYPE/cmd /cmd
bind -a /arch/rc/cmd /cmd bind -a /arch/rc/cmd /cmd
# internal networks # internal networks
@ -42,9 +42,9 @@ mount -a /srv/net /net
mount -b /srv/ssh /net mount -b /srv/ssh /net
bind -c /usr/$user/tmp /tmp bind -c /usr/$USER/tmp /tmp
cd /usr/$user cd /usr/$USER
. /lib/namespace.local . /lib/namespace.local
. /lib/namespace.$sysname . /lib/namespace.$SYSNAME
. /cfg/$sysname/namespace . /cfg/$SYSNAME/namespace

View File

@ -6,7 +6,7 @@ dir=$1
if(~ $dir '') dir=/qa if(~ $dir '') dir=/qa
l = `{du -a /arch/$objtype/$dir|awk '{print $2}'|sort} l = `{du -a /arch/$OBJTYPE/$dir|awk '{print $2}'|sort}
failed = () failed = ()
runner=.runner runner=.runner
@ -17,7 +17,7 @@ for(t in $l){
if not { if not {
echo -n $t: echo -n $t:
$t > /tmp/qa.log >[2=1] $t > /tmp/qa.log >[2=1]
st = $status st = $STATUS
switch( `{echo $st|field 3} ){ switch( `{echo $st|field 3} ){
case PASS case PASS
rm /tmp/qa.log && echo PASS rm /tmp/qa.log && echo PASS

View File

@ -3,27 +3,27 @@
# verify that rc scripts get the correct arguments # verify that rc scripts get the correct arguments
/qa/kern/args.rc.0 a b c /qa/kern/args.rc.0 a b c
a0=`{echo $status|awk '{print $3}'} a0=`{echo $STATUS|awk '{print $3}'}
a0=$"a0 #" a0=$"a0 #"
/qa/kern/args.rc.1 a b c /qa/kern/args.rc.1 a b c
a1=`{echo $status|awk '{print $3}'} a1=`{echo $STATUS|awk '{print $3}'}
a1=$"a1 #" a1=$"a1 #"
/qa/kern/args.rc.2 a b c /qa/kern/args.rc.2 a b c
a2=`{echo $status|awk '{print $3}'} a2=`{echo $STATUS|awk '{print $3}'}
a2=$"a2 #" a2=$"a2 #"
/qa/kern/args.rc.0 /qa/kern/args.rc.0
b0=`{echo $status|awk '{print $3}'} b0=`{echo $STATUS|awk '{print $3}'}
b0=$"b0 #" b0=$"b0 #"
/qa/kern/args.rc.1 /qa/kern/args.rc.1
b1=`{echo $status|awk '{print $3}'} b1=`{echo $STATUS|awk '{print $3}'}
b1=$"b1 #" b1=$"b1 #"
/qa/kern/args.rc.2 /qa/kern/args.rc.2
b2=`{echo $status|awk '{print $3}'} b2=`{echo $STATUS|awk '{print $3}'}
b2=$"b2 #" b2=$"b2 #"
if (test -z $a0 || ! ~ $a0 /qa/kern/args.rc.0) { if (test -z $a0 || ! ~ $a0 /qa/kern/args.rc.0) {

View File

@ -20,7 +20,7 @@ if ( ! ~ $dir $cwd ) {
exit FAIL exit FAIL
} }
ppath=/proc/$pid/wdir ppath=/proc/$PID/wdir
cwd=`{cat $ppath} cwd=`{cat $ppath}
if ( ! ~ $dir $cwd ) { if ( ! ~ $dir $cwd ) {

View File

@ -25,18 +25,18 @@
*/ */
#define ENV_APID "APID" #define ENV_APID "APID"
#define ENV_USER "user" #define ENV_USER "USER"
#define ENV_HOME "home" #define ENV_HOME "HOME"
#define ENV_IFS "ifs" #define ENV_IFS "IFS"
#define ENV_PATH "path" #define ENV_PATH "PATH"
#define ENV_PID "pid" #define ENV_PID "PID"
#define ENV_PROMPT "prompt" #define ENV_PROMPT "PROMPT"
#define ENV_STATUS "status" #define ENV_STATUS "STATUS"
#define ENV_CDPATH "cdpath" #define ENV_CDPATH "CDPATH"
#define ENV_CPUTYPE "cputype" #define ENV_CPUTYPE "CPUTYPE"
#define ENV_SERVICE "service" #define ENV_SERVICE "SERVICE"
#define ENV_SYSNAME "sysname" #define ENV_SYSNAME "SYSNAME"
#define ENV_OBJTYPE "objtype" #define ENV_OBJTYPE "OBJTYPE"
#define ENV_WSYS "wsys" #define ENV_WSYS "wsys"

View File

@ -1368,19 +1368,19 @@ runproc(void *argvp)
Hard: Hard:
/* /*
* ugly: set path = (. $cputype /cmd) * ugly: set PATH = (/cmd . $CPUTYPE)
* should honor $path if unusual. * should honor $PATH if unusual.
*/ */
if(cputype){ if(cputype){
n = 0; n = 0;
memmove(buf+n, ".", 2); memmove(buf+n, "/cmd:", 5);
n += 5;
memmove(buf+n, ".:", 2);
n += 2; n += 2;
i = strlen(cputype)+1; i = strlen(cputype)+1;
memmove(buf+n, cputype, i); memmove(buf+n, cputype, i);
n += i; n += i;
memmove(buf+n, "/cmd", 5); fd = ocreate("/env/PATH", OWRITE, 0666);
n += 5;
fd = ocreate("/env/path", OWRITE, 0666);
write(fd, buf, n); write(fd, buf, n);
close(fd); close(fd);
} }

View File

@ -316,7 +316,7 @@ rowdump(Row *row, char *file)
buf = fbufalloc(); buf = fbufalloc();
if(file == nil){ if(file == nil){
if(home == nil){ if(home == nil){
warning(nil, "can't find file for dump: $home not defined\n"); warning(nil, "can't find file for dump: $HOME not defined\n");
goto Rescue; goto Rescue;
} }
sprint(buf, "%s/acme.dump", home); sprint(buf, "%s/acme.dump", home);
@ -498,7 +498,7 @@ rowload(Row *row, char *file, int initing)
buf = fbufalloc(); buf = fbufalloc();
if(file == nil){ if(file == nil){
if(home == nil){ if(home == nil){
warning(nil, "can't find file for load: $home not defined\n"); warning(nil, "can't find file for load: $HOME not defined\n");
goto Rescue1; goto Rescue1;
} }
sprint(buf, "%s/acme.dump", home); sprint(buf, "%s/acme.dump", home);

View File

@ -25,7 +25,7 @@ void
main(int argc, char **argv) main(int argc, char **argv)
{ {
extern int newnsdebug; extern int newnsdebug;
char *defargv[] = { "/bin/rc", "-i", nil }; char *defargv[] = { "/cmd/rc", "-i", nil };
char *nsfile, err[ERRMAX]; char *nsfile, err[ERRMAX];
int add; int add;
@ -55,7 +55,7 @@ main(int argc, char **argv)
exec(argv[0], argv); exec(argv[0], argv);
if(!rooted(argv[0])){ if(!rooted(argv[0])){
rerrstr(err, sizeof err); rerrstr(err, sizeof err);
exec(smprint("/bin/%s", argv[0]), argv); exec(smprint("/cmd/%s", argv[0]), argv);
errstr(err, sizeof err); errstr(err, sizeof err);
} }
sysfatal("exec: %s: %r", argv[0]); sysfatal("exec: %s: %r", argv[0]);

View File

@ -2,6 +2,7 @@
#define PORTABLE_SYSCALLS #define PORTABLE_SYSCALLS
#include <u.h> #include <u.h>
#include <lib9.h> #include <lib9.h>
#include <envvars.h>
#include <mp.h> #include <mp.h>
#include <libsec.h> #include <libsec.h>
#include <authsrv.h> #include <authsrv.h>

View File

@ -1,8 +1,10 @@
#include <u.h> #include <u.h>
#include <lib9.h> #include <lib9.h>
#include <envvars.h>
#include <auth.h> #include <auth.h>
#include <authsrv.h> #include <authsrv.h>
char* readfile(char *name);
char* readenv(char*); char* readenv(char*);
void setenv(char*, char*); void setenv(char*, char*);
void cpenv(char*, char*); void cpenv(char*, char*);
@ -51,12 +53,16 @@ main(int argc, char *argv[])
close(fd); close(fd);
} }
cpu = readenv("#e/cputype"); cpu = readenv(ENV_CPUTYPE);
setenv("#e/objtype", cpu); setenv(ENV_OBJTYPE, cpu);
setenv("#e/service", service); setenv(ENV_SERVICE, service);
cpenv("/cfg/timezone", "#e/timezone"); cpenv("/cfg/timezone", "timezone");
user = readenv("#c/user"); user = readfile("#c/user");
systemname = readenv("#c/sysname"); if(user == nil)
user = "*unknown*";
systemname = readfile("#c/sysname");
if(systemname == nil)
systemname = "*unknown*";
newns(user, 0); newns(user, 0);
iscpu = strcmp(service, "cpu")==0; iscpu = strcmp(service, "cpu")==0;
@ -155,7 +161,7 @@ rcexec(void)
else if(manual || iscpu){ else if(manual || iscpu){
execl("/cmd/rc", "rc", "-m/arch/rc/lib/rcmain", "-i", nil); execl("/cmd/rc", "rc", "-m/arch/rc/lib/rcmain", "-i", nil);
}else if(strcmp(service, "terminal") == 0) }else if(strcmp(service, "terminal") == 0)
execl("/cmd/rc", "rc", "-c", ". /sys/lib/rc/startup/terminal; home=/usr/$user; cd && . lib/profile", nil); execl("/cmd/rc", "rc", "-c", ". /sys/lib/rc/startup/terminal; HOME=/usr/$USER; cd && . lib/profile", nil);
else else
execl("/cmd/rc", "rc", nil); execl("/cmd/rc", "rc", nil);
} }
@ -208,8 +214,10 @@ char*
readenv(char *name) readenv(char *name)
{ {
char *val; char *val;
char buf[128+4];
val = readfile(name); snprint(buf, sizeof(buf), "#e/%s", name);
val = readfile(buf);
if(val == nil) if(val == nil)
val = "*unknown*"; val = "*unknown*";
return val; return val;
@ -219,10 +227,12 @@ void
setenv(char *name, char *val) setenv(char *name, char *val)
{ {
int fd; int fd;
char buf[128+4];
fd = ocreate(name, OWRITE, 0644); snprint(buf, sizeof(buf), "#e/%s", name);
fd = ocreate(buf, OWRITE, 0644);
if(fd < 0) if(fd < 0)
fprint(2, "init: can't create %s: %r\n", name); fprint(2, "init: can't create %s: %r\n", buf);
else{ else{
write(fd, val, strlen(val)); write(fd, val, strlen(val));
close(fd); close(fd);
@ -230,13 +240,13 @@ setenv(char *name, char *val)
} }
void void
cpenv(char *from, char *to) cpenv(char *from, char *envname)
{ {
char *val; char *val;
val = readfile(from); val = readfile(from);
if(val != nil){ if(val != nil){
setenv(to, val); setenv(envname, val);
free(val); free(val);
} }
} }

View File

@ -100,7 +100,7 @@ main(int argc, char *argv[])
argv0 = argv[0]; argv0 = argv[0];
cpu = getenv(ENV_CPUTYPE); cpu = getenv(ENV_CPUTYPE);
if(cpu == 0) if(cpu == 0)
error("can't get cputype"); error("can't get $CPUTYPE");
ARGBEGIN{ ARGBEGIN{
case 'd': case 'd':

View File

@ -199,7 +199,7 @@ execcd(void)
pfmt(err, "Can't cd %s: %r\n", a->word); pfmt(err, "Can't cd %s: %r\n", a->word);
} }
else else
pfmt(err, "Can't cd -- $home empty\n"); pfmt(err, "Can't cd -- $HOME empty\n");
break; break;
} }
poplist(); poplist();

View File

@ -1239,7 +1239,7 @@ main(int argc, char *argv[])
nmach = 1; nmach = 1;
mysysname = getenv(ENV_SYSNAME); mysysname = getenv(ENV_SYSNAME);
if(mysysname == nil){ if(mysysname == nil){
fprint(2, "stats: can't find $sysname: %r\n"); fprint(2, "stats: can't find $" ENV_SYSNAME ": %r\n");
exits("sysname"); exits("sysname");
} }

View File

@ -212,7 +212,7 @@ configure_kernel(void)
int i, userpcnt; int i, userpcnt;
unsigned int kpages; unsigned int kpages;
if(p = getconf("service")){ if(p = getconf(ENV_SERVICE)){
if(strcmp(p, "cpu") == 0) if(strcmp(p, "cpu") == 0)
cpuserver = 1; cpuserver = 1;
else if(strcmp(p,"terminal") == 0) else if(strcmp(p,"terminal") == 0)

View File

@ -93,7 +93,7 @@ boot(int argc, char *argv[])
fflag = 1; fflag = 1;
break; break;
}ARGEND }ARGEND
readfile("#e/cputype", cputype, sizeof(cputype)); readfile("#e/" ENV_CPUTYPE, cputype, sizeof(cputype));
/* /*
* set up usb keyboard, mouse and disk, if any. * set up usb keyboard, mouse and disk, if any.

View File

@ -3,5 +3,5 @@
cd /sys/src/kern/boot cd /sys/src/kern/boot
mkdir -p bootfs mkdir -p bootfs
disk/mkfs -s / -d bootfs bootfs.proto disk/mkfs -s / -d bootfs bootfs.proto
disk/mkrofs -o /arch/$objtype/kern/initrd bootfs disk/mkrofs -o /arch/$OBJTYPE/kern/initrd bootfs
rm -rf bootfs rm -rf bootfs

View File

@ -1,16 +1,16 @@
O=$1 O=$1
shift shift
objtype=$1 OBJTYPE=$1
shift shift
ls -p ../$objtype/*.[cs] >[2]/dev/null | sed 's/..$//' > /tmp/reduce.$pid ls -p ../$OBJTYPE/*.[cs] >[2]/dev/null | sed 's/..$//' > /tmp/reduce.$PID
# #
# if empty directory, just return the input files # if empty directory, just return the input files
# #
if (! ~ $status '|') { if (! ~ $STATUS '|') {
echo $* echo $*
rm /tmp/reduce.$pid rm /tmp/reduce.$PID
exit 0 exit 0
} }
echo $* | tr ' ' \012 | grep -v -f /tmp/reduce.$pid | tr \012 ' ' echo $* | tr ' ' \012 | grep -v -f /tmp/reduce.$PID | tr \012 ' '
rm /tmp/reduce.$pid rm /tmp/reduce.$PID

View File

@ -1,16 +1,16 @@
O=$1 O=$1
shift shift
objtype=$1 OBJTYPE=$1
shift shift
ls -p ../$objtype/*.[cs] >[2]/dev/null | sed 's/..$//' > /tmp/reduce.$pid ls -p ../$OBJTYPE/*.[cs] >[2]/dev/null | sed 's/..$//' > /tmp/reduce.$PID
# #
# if empty directory, just return the input files # if empty directory, just return the input files
# #
if (! ~ $status '|') { if (! ~ $STATUS '|') {
echo $* echo $*
rm /tmp/reduce.$pid rm /tmp/reduce.$PID
exit 0 exit 0
} }
echo $* | tr ' ' \012 | grep -v -f /tmp/reduce.$pid | tr \012 ' ' echo $* | tr ' ' \012 | grep -v -f /tmp/reduce.$PID | tr \012 ' '
rm /tmp/reduce.$pid rm /tmp/reduce.$PID