More little bug fixes

This commit is contained in:
rsc 2004-05-14 17:45:39 +00:00
parent 1a8f27c350
commit f1bfc54e12
9 changed files with 31 additions and 7 deletions

View file

@ -38,7 +38,7 @@ data matches '[a-zA-Z¡-
data matches '([a-zA-Z¡-￿0-9_\-./]+)\.(jpe?g|JPE?G|gif|GIF|tiff?|TIFF?|ppm|bit|png|PNG)' data matches '([a-zA-Z¡-￿0-9_\-./]+)\.(jpe?g|JPE?G|gif|GIF|tiff?|TIFF?|ppm|bit|png|PNG)'
arg isfile $0 arg isfile $0
plumb to image plumb to image
plumb start qiv -t $0 plumb start qiv -t $file
# postscript/pdf/dvi go to page but not over the a plumb port # postscript/pdf/dvi go to page but not over the a plumb port
# the port is here for reference but is unused # the port is here for reference but is unused

6
rcmain
View file

@ -10,7 +10,7 @@ case 1
prompt=($prompt ' ') prompt=($prompt ' ')
} }
if(~ $rcname ?.out ?.rc */?.rc */?.out) prompt=('broken! ' ' ') if(~ $rcname ?.out ?.rc */?.rc */?.out) prompt=('broken! ' ' ')
if(flag p) path=(/bin) if(flag p) path=(/bin /usr/bin)
if not{ if not{
finit finit
if(~ $#path 0) { if(~ $#path 0) {
@ -28,9 +28,9 @@ if(! ~ $#cflag 0){
if not if(flag i){ if not if(flag i){
if(~ $TERM 9term){ if(~ $TERM 9term){
if(~ $#'fn#cd' 0) if(~ $#'fn#cd' 0)
fn cd { builtin cd $1 && label `{pwd} } fn cd { builtin cd $1 && flag i && awd }
} }
if(flag l && /bin/test -r $home/lib/profile) . $home/lib/profile if(flag l && test -r $home/lib/profile) . $home/lib/profile
status='' status=''
if(! ~ $#* 0) . $* if(! ~ $#* 0) . $*
. -i '/dev/stdin' . -i '/dev/stdin'

View file

@ -23,12 +23,20 @@ readenv(void)
Word *w; Word *w;
for(p = environ; *p; p++){ for(p = environ; *p; p++){
/* rsc 5/5/2004 -- This misparses fn#cd={whatever}
s = shname(*p); s = shname(*p);
if(*s == '=') { if(*s == '=') {
*s = 0; *s = 0;
w = newword(s+1); w = newword(s+1);
} else } else
w = newword(""); w = newword("");
*/
s = strchr(*p, '=');
if(s){
*s = 0;
w = newword(s+1);
} else
w = newword("");
if (symlook(*p, S_INTERNAL, 0)) if (symlook(*p, S_INTERNAL, 0))
continue; continue;
s = strdup(*p); s = strdup(*p);

View file

@ -5,7 +5,7 @@ SHORTLIB=sec fs mux regexp9 thread bio 9
<$PLAN9/src/mkmany <$PLAN9/src/mkmany
BUGGERED='CVS|faces|factotum|mailfs|scat|upas|vac|venti|lex' BUGGERED='CVS|faces|factotum|mailfs|scat|upas|vac|venti|lex|vncv'
DIRS=`ls -l |sed -n 's/^d.* //p' |egrep -v "^($BUGGERED)$"` DIRS=`ls -l |sed -n 's/^d.* //p' |egrep -v "^($BUGGERED)$"`
<$PLAN9/src/mkdirs <$PLAN9/src/mkdirs

View file

@ -34,7 +34,6 @@ char Fdprefix[]="/dev/fd/";
void execfinit(void); void execfinit(void);
void execbind(void); void execbind(void);
void execmount(void); void execmount(void);
void execnewpgrp(void);
builtin Builtin[]={ builtin Builtin[]={
"cd", execcd, "cd", execcd,
"whatis", execwhatis, "whatis", execwhatis,

View file

@ -18,3 +18,5 @@ struct Uproc
extern Uproc *_p9uproc(int); extern Uproc *_p9uproc(int);
extern void _p9uprocdie(void); extern void _p9uprocdie(void);
extern void _clearuproc(void);

View file

@ -18,6 +18,19 @@ static Uproc *alluproc[PIDHASH];
static int allupid[PIDHASH]; static int allupid[PIDHASH];
static Lock uproclock; static Lock uproclock;
void
_clearuproc(void)
{
int i;
/* called right after fork - no locking needed */
for(i=0; i<PIDHASH; i++)
if(alluproc[i] != T && alluproc[i] != 0)
free(alluproc[i]);
memset(alluproc, 0, sizeof alluproc);
memset(allupid, 0, sizeof allupid);
}
Uproc* Uproc*
_p9uproc(int inhandler) _p9uproc(int inhandler)
{ {

View file

@ -9,6 +9,7 @@ p9fork(void)
int pid; int pid;
pid = fork(); pid = fork();
_clearuproc();
_p9uproc(0); _p9uproc(0);
return pid; return pid;
} }

View file

@ -55,9 +55,10 @@ threadexitsall(char *exitstr)
_threaddebug(DBGSCHED, "threadexitsall kill %d", pid[i]); _threaddebug(DBGSCHED, "threadexitsall kill %d", pid[i]);
if(pid[i]==0 || pid[i]==-1) if(pid[i]==0 || pid[i]==-1)
fprint(2, "bad pid in threadexitsall: %d\n", pid[i]); fprint(2, "bad pid in threadexitsall: %d\n", pid[i]);
else if(pid[i] != mypid) else if(pid[i] != mypid){
kill(pid[i], SIGTERM); kill(pid[i], SIGTERM);
} }
}
/* leave */ /* leave */
exit(0); exit(0);