Browse Source

Plan 9 from Bell Labs 2008-07-07

David du Colombier 12 years ago
parent
commit
ff2c939c0b

+ 8 - 9
dist/replica/_plan9.db

@@ -12546,14 +12546,14 @@ sys/src/cmd/ip/imap4d/csquery.c - 664 sys sys 1015013076 762
 sys/src/cmd/ip/imap4d/date.c - 664 sys sys 1151455743 5684
 sys/src/cmd/ip/imap4d/debug.c - 664 sys sys 1016731557 1962
 sys/src/cmd/ip/imap4d/fetch.c - 664 sys sys 1066325855 11762
-sys/src/cmd/ip/imap4d/fns.h - 664 sys sys 1015013076 4282
+sys/src/cmd/ip/imap4d/fns.h - 664 sys sys 1215381935 4349
 sys/src/cmd/ip/imap4d/folder.c - 664 sys sys 1015013076 5959
 sys/src/cmd/ip/imap4d/imap4d.c - 664 sys sys 1066325859 40675
 sys/src/cmd/ip/imap4d/imap4d.h - 664 sys sys 1015013076 6697
 sys/src/cmd/ip/imap4d/list.c - 664 sys sys 1015013076 7619
 sys/src/cmd/ip/imap4d/mbox.c - 664 sys sys 1214367224 16972
 sys/src/cmd/ip/imap4d/mkfile - 664 sys sys 1063897579 332
-sys/src/cmd/ip/imap4d/msg.c - 664 sys sys 1168894057 31415
+sys/src/cmd/ip/imap4d/msg.c - 664 sys sys 1215381935 31417
 sys/src/cmd/ip/imap4d/mutf7.c - 664 sys sys 1015013077 2724
 sys/src/cmd/ip/imap4d/nodes.c - 664 sys sys 1015013077 3173
 sys/src/cmd/ip/imap4d/search.c - 664 sys sys 1213893891 4557
@@ -13289,9 +13289,8 @@ sys/src/cmd/ratfs/ratfs.h - 664 sys sys 1016943965 2743
 sys/src/cmd/rc - 20000000775 sys sys 1071884773 0
 sys/src/cmd/rc/code.c - 664 sys sys 1182898057 8218
 sys/src/cmd/rc/compiling.on.unix - 664 sys sys 1071884773 37638
-sys/src/cmd/rc/exec.c - 664 sys sys 1182917722 16579
+sys/src/cmd/rc/exec.c - 664 sys sys 1215383574 16601
 sys/src/cmd/rc/exec.h - 664 sys sys 1174851874 2828
-sys/src/cmd/rc/fmtquote.c - 664 sys sys 1055698768 3609
 sys/src/cmd/rc/fns.h - 664 sys sys 1182899939 1490
 sys/src/cmd/rc/getflags.c - 664 sys sys 1182917999 3743
 sys/src/cmd/rc/getflags.h - 664 sys sys 1182886902 133
@@ -13299,22 +13298,22 @@ sys/src/cmd/rc/glob.c - 664 sys sys 1182918194 4669
 sys/src/cmd/rc/havefork.c - 664 sys sys 1182918331 3751
 sys/src/cmd/rc/haventfork.c - 664 sys sys 1182918434 3141
 sys/src/cmd/rc/here.c - 664 sys sys 1182918533 2510
-sys/src/cmd/rc/io.c - 664 sys sys 1182918677 3793
+sys/src/cmd/rc/io.c - 664 sys sys 1215383575 3808
 sys/src/cmd/rc/io.h - 664 sys sys 1182905845 523
 sys/src/cmd/rc/lex.c - 664 sys sys 1174851509 6203
 sys/src/cmd/rc/mkfile - 664 sys sys 1182890797 825
 sys/src/cmd/rc/pcmd.c - 664 sys sys 1100894077 2681
 sys/src/cmd/rc/pfnc.c - 664 sys sys 1100894077 1320
-sys/src/cmd/rc/plan9.c - 664 sys sys 1182918888 10084
+sys/src/cmd/rc/plan9.c - 664 sys sys 1215383577 10084
 sys/src/cmd/rc/rc.h - 664 sys sys 1182898644 3326
-sys/src/cmd/rc/simple.c - 664 sys sys 1182919012 9205
+sys/src/cmd/rc/simple.c - 664 sys sys 1215383579 9205
 sys/src/cmd/rc/subr.c - 664 sys sys 1182919084 1200
 sys/src/cmd/rc/syn.y - 664 sys sys 944961083 3128
 sys/src/cmd/rc/trap.c - 664 sys sys 1174851077 878
 sys/src/cmd/rc/tree.c - 664 sys sys 1182898340 2081
 sys/src/cmd/rc/unix.c - 664 sys sys 1182898521 8708
 sys/src/cmd/rc/var.c - 664 sys sys 1055698781 1298
-sys/src/cmd/rc/win32.c - 664 sys sys 1182898536 8691
+sys/src/cmd/rc/win32.c - 664 sys sys 1215383581 8691
 sys/src/cmd/rdbfs.c - 664 sys sys 1142342219 7633
 sys/src/cmd/read.c - 664 sys sys 1022047660 1278
 sys/src/cmd/replica - 20000000775 sys sys 1053210813 0
@@ -15616,7 +15615,7 @@ sys/src/liboventi/venti.txt - 664 sys sys 1045502097 4347
 sys/src/liboventi/zero.c - 664 sys sys 1188621652 1510
 sys/src/libplumb - 20000000775 sys sys 1123099015 0
 sys/src/libplumb/event.c - 664 sys sys 947358887 1861
-sys/src/libplumb/mesg.c - 664 sys sys 1133279518 7080
+sys/src/libplumb/mesg.c - 664 sys sys 1215382705 7091
 sys/src/libplumb/mkfile - 664 sys sys 1035389780 228
 sys/src/libplumb/plumbsendtext.c - 664 sys sys 1014928082 288
 sys/src/libregexp - 20000000775 sys sys 1058129062 0

+ 8 - 9
dist/replica/plan9.db

@@ -12546,14 +12546,14 @@ sys/src/cmd/ip/imap4d/csquery.c - 664 sys sys 1015013076 762
 sys/src/cmd/ip/imap4d/date.c - 664 sys sys 1151455743 5684
 sys/src/cmd/ip/imap4d/debug.c - 664 sys sys 1016731557 1962
 sys/src/cmd/ip/imap4d/fetch.c - 664 sys sys 1066325855 11762
-sys/src/cmd/ip/imap4d/fns.h - 664 sys sys 1015013076 4282
+sys/src/cmd/ip/imap4d/fns.h - 664 sys sys 1215381935 4349
 sys/src/cmd/ip/imap4d/folder.c - 664 sys sys 1015013076 5959
 sys/src/cmd/ip/imap4d/imap4d.c - 664 sys sys 1066325859 40675
 sys/src/cmd/ip/imap4d/imap4d.h - 664 sys sys 1015013076 6697
 sys/src/cmd/ip/imap4d/list.c - 664 sys sys 1015013076 7619
 sys/src/cmd/ip/imap4d/mbox.c - 664 sys sys 1214367224 16972
 sys/src/cmd/ip/imap4d/mkfile - 664 sys sys 1063897579 332
-sys/src/cmd/ip/imap4d/msg.c - 664 sys sys 1168894057 31415
+sys/src/cmd/ip/imap4d/msg.c - 664 sys sys 1215381935 31417
 sys/src/cmd/ip/imap4d/mutf7.c - 664 sys sys 1015013077 2724
 sys/src/cmd/ip/imap4d/nodes.c - 664 sys sys 1015013077 3173
 sys/src/cmd/ip/imap4d/search.c - 664 sys sys 1213893891 4557
@@ -13289,9 +13289,8 @@ sys/src/cmd/ratfs/ratfs.h - 664 sys sys 1016943965 2743
 sys/src/cmd/rc - 20000000775 sys sys 1071884773 0
 sys/src/cmd/rc/code.c - 664 sys sys 1182898057 8218
 sys/src/cmd/rc/compiling.on.unix - 664 sys sys 1071884773 37638
-sys/src/cmd/rc/exec.c - 664 sys sys 1182917722 16579
+sys/src/cmd/rc/exec.c - 664 sys sys 1215383574 16601
 sys/src/cmd/rc/exec.h - 664 sys sys 1174851874 2828
-sys/src/cmd/rc/fmtquote.c - 664 sys sys 1055698768 3609
 sys/src/cmd/rc/fns.h - 664 sys sys 1182899939 1490
 sys/src/cmd/rc/getflags.c - 664 sys sys 1182917999 3743
 sys/src/cmd/rc/getflags.h - 664 sys sys 1182886902 133
@@ -13299,22 +13298,22 @@ sys/src/cmd/rc/glob.c - 664 sys sys 1182918194 4669
 sys/src/cmd/rc/havefork.c - 664 sys sys 1182918331 3751
 sys/src/cmd/rc/haventfork.c - 664 sys sys 1182918434 3141
 sys/src/cmd/rc/here.c - 664 sys sys 1182918533 2510
-sys/src/cmd/rc/io.c - 664 sys sys 1182918677 3793
+sys/src/cmd/rc/io.c - 664 sys sys 1215383575 3808
 sys/src/cmd/rc/io.h - 664 sys sys 1182905845 523
 sys/src/cmd/rc/lex.c - 664 sys sys 1174851509 6203
 sys/src/cmd/rc/mkfile - 664 sys sys 1182890797 825
 sys/src/cmd/rc/pcmd.c - 664 sys sys 1100894077 2681
 sys/src/cmd/rc/pfnc.c - 664 sys sys 1100894077 1320
-sys/src/cmd/rc/plan9.c - 664 sys sys 1182918888 10084
+sys/src/cmd/rc/plan9.c - 664 sys sys 1215383577 10084
 sys/src/cmd/rc/rc.h - 664 sys sys 1182898644 3326
-sys/src/cmd/rc/simple.c - 664 sys sys 1182919012 9205
+sys/src/cmd/rc/simple.c - 664 sys sys 1215383579 9205
 sys/src/cmd/rc/subr.c - 664 sys sys 1182919084 1200
 sys/src/cmd/rc/syn.y - 664 sys sys 944961083 3128
 sys/src/cmd/rc/trap.c - 664 sys sys 1174851077 878
 sys/src/cmd/rc/tree.c - 664 sys sys 1182898340 2081
 sys/src/cmd/rc/unix.c - 664 sys sys 1182898521 8708
 sys/src/cmd/rc/var.c - 664 sys sys 1055698781 1298
-sys/src/cmd/rc/win32.c - 664 sys sys 1182898536 8691
+sys/src/cmd/rc/win32.c - 664 sys sys 1215383581 8691
 sys/src/cmd/rdbfs.c - 664 sys sys 1142342219 7633
 sys/src/cmd/read.c - 664 sys sys 1022047660 1278
 sys/src/cmd/replica - 20000000775 sys sys 1053210813 0
@@ -15616,7 +15615,7 @@ sys/src/liboventi/venti.txt - 664 sys sys 1045502097 4347
 sys/src/liboventi/zero.c - 664 sys sys 1188621652 1510
 sys/src/libplumb - 20000000775 sys sys 1123099015 0
 sys/src/libplumb/event.c - 664 sys sys 947358887 1861
-sys/src/libplumb/mesg.c - 664 sys sys 1133279518 7080
+sys/src/libplumb/mesg.c - 664 sys sys 1215382705 7091
 sys/src/libplumb/mkfile - 664 sys sys 1035389780 228
 sys/src/libplumb/plumbsendtext.c - 664 sys sys 1014928082 288
 sys/src/libregexp - 20000000775 sys sys 1058129062 0

+ 9 - 0
dist/replica/plan9.log

@@ -20014,3 +20014,12 @@
 1214510404 35 c 386/lib/libventi.a - 664 sys sys 1214510301 191836
 1214537404 0 c 386/bin/games/mp3dec - 775 sys sys 1214537048 222181
 1214620204 0 c sys/man/1/page - 664 sys sys 1214619217 5840
+1215383404 0 c sys/src/cmd/ip/imap4d/fns.h - 664 sys sys 1215381935 4349
+1215383404 1 c sys/src/cmd/ip/imap4d/msg.c - 664 sys sys 1215381935 31417
+1215383404 2 c sys/src/cmd/rc/exec.c - 664 sys sys 1215383574 16601
+1215383404 3 c sys/src/cmd/rc/io.c - 664 sys sys 1215383575 3808
+1215383404 4 c sys/src/cmd/rc/plan9.c - 664 sys sys 1215383577 10084
+1215383404 5 c sys/src/cmd/rc/simple.c - 664 sys sys 1215383579 9205
+1215383404 6 c sys/src/cmd/rc/win32.c - 664 sys sys 1215383581 8691
+1215383404 7 c sys/src/libplumb/mesg.c - 664 sys sys 1215382705 7091
+1215383404 8 d sys/src/cmd/rc/fmtquote.c - 664 sys sys 1055698768 0

+ 3 - 0
sys/src/cmd/ip/imap4d/fns.h

@@ -113,6 +113,9 @@ void	wrImpFlags(char *buf, int flags, int killRecent);
 void	writeErr(void);
 void	writeFlags(Biobuf *b, Msg *m, int recentOk);
 
+#pragma	varargck argpos	bye		1
+#pragma	varargck argpos	debuglog	1
+
 #define	MK(t)		((t*)emalloc(sizeof(t)))
 #define	MKZ(t)		((t*)ezmalloc(sizeof(t)))
 #define	MKN(t,n)	((t*)emalloc((n)*sizeof(t)))

+ 1 - 1
sys/src/cmd/ip/imap4d/msg.c

@@ -858,7 +858,7 @@ msgHeader(Msg *m, Header *h, char *file)
 	h->buf[nn++] = '\n';
 	h->buf[nn] = '\0';
 	if(nn != n)
-		bye("misconverted header %d %d", nn, n);
+		bye("misconverted header %ld %ld", nn, n);
 	free(s);
 
 	/*

+ 5 - 2
sys/src/cmd/rc/exec.c

@@ -751,9 +751,11 @@ Xlocal(void)
 	}
 	deglob(runq->argv->words->word);
 	runq->local = newvar(strdup(runq->argv->words->word), runq->local);
-	runq->local->val = copywords(runq->argv->next->words, (word *)0);
-	runq->local->changed = 1;
 	poplist();
+	globlist();
+	runq->local->val = runq->argv->words;
+	runq->local->changed = 1;
+	runq->argv->words = 0;
 	poplist();
 }
 
@@ -790,6 +792,7 @@ Xfn(void)
 	word *a;
 	int end;
 	end = runq->code[runq->pc].i;
+	globlist();
 	for(a = runq->argv->words;a;a = a->next){
 		v = gvlook(a->word);
 		if(v->fn)

+ 0 - 162
sys/src/cmd/rc/fmtquote.c

@@ -1,162 +0,0 @@
-/*
- * The authors of this software are Rob Pike and Ken Thompson.
- *              Copyright (c) 2002 by Lucent Technologies.
- * Permission to use, copy, modify, and distribute this software for any
- * purpose without fee is hereby granted, provided that this entire notice
- * is included in all copies of any software which is or includes a copy
- * or modification of this software and in all copies of the supporting
- * documentation for such software.
- * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED
- * WARRANTY.  IN PARTICULAR, NEITHER THE AUTHORS NOR LUCENT TECHNOLOGIES MAKE ANY
- * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY
- * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE.
- */
-#include <u.h>
-#include <libc.h>
-#include "fmt.h"
-#include "fmtdef.h"
-
-extern int (*doquote)(int);
-
-/*
- * How many bytes of output UTF will be produced by quoting (if necessary) this string?
- * How many runes? How much of the input will be consumed?
- * The parameter q is filled in by _quotesetup.
- * The string may be UTF or Runes (s or r).
- * Return count does not include NUL.
- * Terminate the scan at the first of:
- *	NUL in input
- *	count exceeded in input
- *	count exceeded on output
- * *ninp is set to number of input bytes accepted.
- * nin may be <0 initially, to avoid checking input by count.
- */
-void
-__quotesetup(char *s, int nin, int nout, Quoteinfo *q, int sharp)
-{
-	int c;
-
-	q->quoted = 0;
-	q->nbytesout = 0;
-	q->nrunesout = 0;
-	q->nbytesin = 0;
-	q->nrunesin = 0;
-	if(sharp || nin==0 || *s=='\0'){
-		if(nout < 2)
-			return;
-		q->quoted = 1;
-		q->nbytesout = 2;
-		q->nrunesout = 2;
-	}
-	for(; nin!=0; nin-=1){
-		c = *s;
-
-		if(c == '\0')
-			break;
-		if(q->nrunesout+1 > nout)
-			break;
-
-		if((c <= L' ') || (c == L'\'') || (doquote!=nil && doquote(c))){
-			if(!q->quoted){
-				if(1+q->nrunesout+1+1 > nout)	/* no room for quotes */
-					break;
-				q->nrunesout += 2;	/* include quotes */
-				q->nbytesout += 2;	/* include quotes */
-				q->quoted = 1;
-			}
-			if(c == '\'')	{
-				q->nbytesout++;
-				q->nrunesout++;	/* quotes reproduce as two characters */
-			}
-		}
-
-		/* advance input */
-		s++;
-		q->nbytesin++;
-		q->nrunesin++;
-
-		/* advance output */
-		q->nbytesout++;
-		q->nrunesout++;
-	}
-}
-
-static int
-qstrfmt(char *sin, Quoteinfo *q, Fmt *f)
-{
-	int r;
-	char *t, *s, *m, *me;
-	ulong fl;
-	int nc, w;
-
-	m = sin;
-	me = m + q->nbytesin;
-
-	w = f->width;
-	fl = f->flags;
-	if(!(fl & FmtLeft) && __fmtpad(f, w - q->nbytesout) < 0)
-		return -1;
-	t = f->to;
-	s = f->stop;
-	FMTCHAR(f, t, s, '\'');
-	for(nc = q->nrunesin; nc > 0; nc--){
-		r = *(uchar*)m++;
-		FMTCHAR(f, t, s, r);
-		if(r == '\'')
-			FMTCHAR(f, t, s, r);
-	}
-
-	FMTCHAR(f, t, s, '\'');
-	f->nfmt += t - (char *)f->to;
-	f->to = t;
-	if(fl & FmtLeft && __fmtpad(f, w - q->nbytesout) < 0)
-		return -1;
-	return 0;
-}
-
-int
-__quotestrfmt(int runesin, Fmt *f)
-{
-	int outlen;
-	char *s;
-	Quoteinfo q;
-
-	f->flags &= ~FmtPrec;	/* ignored for %q %Q, so disable for %s %S in easy case */
-	s = va_arg(f->args, char *);
-	if(!s)
-		return __fmtcpy(f, "<nil>", 5, 5);
-
-	if(f->flush)
-		outlen = 0x7FFFFFFF;	/* if we can flush, no output limit */
-	else
-		outlen = (char*)f->stop - (char*)f->to;
-
-	__quotesetup(s, -1, outlen, &q, f->flags&FmtSharp);
-
-	if(!q.quoted)
-		return __fmtcpy(f, s, q.nrunesin, q.nbytesin);
-	return qstrfmt(s, &q, f);
-}
-
-int
-quotestrfmt(Fmt *f)
-{
-	return __quotestrfmt(0, f);
-}
-
-void
-quotefmtinstall(void)
-{
-	fmtinstall('q', quotestrfmt);
-}
-
-int
-__needsquotes(char *s, int *quotelenp)
-{
-	Quoteinfo q;
-
-	__quotesetup(s, -1, 0x7FFFFFFF, &q, 0);
-	*quotelenp = q.nbytesout;
-
-	return q.quoted;
-}

+ 1 - 1
sys/src/cmd/rc/io.c

@@ -91,7 +91,7 @@ void
 pwrd(io *f, char *s)
 {
 	char *t;
-	for(t = s;*t;t++) if(!wordchr(*t)) break;
+	for(t = s;*t;t++) if(*t >= 0 && needsrcquote(*t)) break;
 	if(t==s || *t)
 		pquo(f, s);
 	else pstr(f, s);

+ 1 - 1
sys/src/cmd/rc/plan9.c

@@ -275,7 +275,7 @@ addenv(var *v)
 		else{
 			if(v->fn){
 				fd = openfd(f);
-				pfmt(fd, "fn %s %s\n", v->name, v->fn[v->pc-1].s);
+				pfmt(fd, "fn %q %s\n", v->name, v->fn[v->pc-1].s);
 				closeio(fd);
 			}
 			close(f);

+ 1 - 1
sys/src/cmd/rc/simple.c

@@ -466,7 +466,7 @@ execwhatis(void){	/* mildly wrong -- should fork before writing */
 			found = 0;
 		v = gvlook(a->word);
 		if(v->fn)
-			pfmt(out, "fn %s %s\n", v->name, v->fn[v->pc-1].s);
+			pfmt(out, "fn %q %s\n", v->name, v->fn[v->pc-1].s);
 		else{
 			for(bp = Builtin;bp->name;bp++)
 				if(strcmp(a->word, bp->name)==0){

+ 1 - 1
sys/src/cmd/rc/win32.c

@@ -211,7 +211,7 @@ addenv(var *v)
 		else{
 			if(v->fn){
 				fd = openfd(f);
-				pfmt(fd, "fn %s %s\n", v->name, v->fn[v->pc-1].s);
+				pfmt(fd, "fn %q %s\n", v->name, v->fn[v->pc-1].s);
 				closeio(fd);
 			}
 			close(f);

+ 1 - 0
sys/src/libplumb/mesg.c

@@ -26,6 +26,7 @@ plumbopen(char *name, int omode)
 		if(s == nil)
 			return -1;
 		f = open(s, ORDWR);
+		free(s);
 		if(f < 0)
 			return -1;
 		if(mount(f, -1, "/mnt/plumb", MREPL, "") < 0){