Browse Source

Plan 9 from Bell Labs 2007-05-24

David du Colombier 14 years ago
parent
commit
1eb1205b90

+ 5 - 3
dist/replica/_plan9.db

@@ -5819,7 +5819,7 @@ sys/games - 20000000775 sys sys 1117225532 0
 sys/games/lib - 20000000775 sys sys 1165337608 0
 sys/games/lib/4scores - 10000000666 sys sys 1118680448 0
 sys/games/lib/5scores - 10000000666 sys sys 1118680453 0
-sys/games/lib/fortunes - 664 sys sys 1179445990 265143
+sys/games/lib/fortunes - 664 sys sys 1179957238 265482
 sys/games/lib/mahjongg - 20000000775 sys sys 1095792278 0
 sys/games/lib/mahjongg/backgrounds - 20000000775 sys sys 1095792293 0
 sys/games/lib/mahjongg/backgrounds/default.bit - 664 sys sys 1095792293 346803
@@ -8168,7 +8168,7 @@ sys/src/9/port/devcons.c - 664 sys sys 1176658321 22943
 sys/src/9/port/devdraw.c - 664 sys sys 1147023550 44447
 sys/src/9/port/devdup.c - 664 sys sys 1014931172 2332
 sys/src/9/port/devenv.c - 664 sys sys 1169498893 7015
-sys/src/9/port/devfs.c - 664 sys sys 1179726929 12395
+sys/src/9/port/devfs.c - 664 sys sys 1179951300 12209
 sys/src/9/port/devkbmap.c - 664 sys sys 1130763846 3064
 sys/src/9/port/devkprof.c - 664 sys sys 1014931173 3111
 sys/src/9/port/devloopback.c - 664 sys sys 1138458368 14579
@@ -14141,7 +14141,7 @@ sys/src/cmd/upas/bayes/msgtok.c - 664 sys sys 1063951010 4185
 sys/src/cmd/upas/bayes/regcomp.c - 664 sys sys 1063951010 9707
 sys/src/cmd/upas/bayes/regen.c - 664 sys sys 1063951011 2452
 sys/src/cmd/upas/common - 20000000775 sys sys 1075064534 0
-sys/src/cmd/upas/common/appendfiletombox.c - 664 sys sys 1075064534 2154
+sys/src/cmd/upas/common/appendfiletombox.c - 664 sys sys 1179946114 2563
 sys/src/cmd/upas/common/aux.c - 664 sys sys 1019498851 2300
 sys/src/cmd/upas/common/become.c - 664 sys sys 1015009623 430
 sys/src/cmd/upas/common/common.h - 664 sys sys 1098803897 2040
@@ -15838,3 +15838,5 @@ usr/glenda/lib/profile - 664 glenda glenda 1105128663 890
 usr/glenda/readme.acme - 664 glenda glenda 1019860628 4753
 usr/glenda/readme.rio - 664 glenda glenda 1019860628 6370
 usr/glenda/tmp - 20000000775 glenda glenda 1018802620 0
+386/bin/upas/deliver - 775 sys sys 1179976975 99212
+386/bin/upas/nedmail - 775 sys sys 1179976975 156013

+ 5 - 5
dist/replica/plan9.db

@@ -455,7 +455,7 @@
 386/bin/upas/addhash - 775 sys sys 1178568309 70721
 386/bin/upas/aliasmail - 775 sys sys 1178568309 104105
 386/bin/upas/bayes - 775 sys sys 1178568309 73372
-386/bin/upas/deliver - 775 sys sys 1178568310 99134
+386/bin/upas/deliver - 775 sys sys 1179976975 99212
 386/bin/upas/filter - 775 sys sys 1179548034 146753
 386/bin/upas/fs - 775 sys sys 1178568311 331725
 386/bin/upas/isspam - 775 sys sys 1064598349 38
@@ -466,7 +466,7 @@
 386/bin/upas/mlowner - 775 sys sys 1177617496 92263
 386/bin/upas/msgcat - 775 sys sys 1064598353 38
 386/bin/upas/msgtok - 775 sys sys 1176520508 76758
-386/bin/upas/nedmail - 775 sys sys 1179548035 155935
+386/bin/upas/nedmail - 775 sys sys 1179976975 156013
 386/bin/upas/pop3 - 775 sys sys 1179372109 261615
 386/bin/upas/qer - 775 sys sys 1178568313 99195
 386/bin/upas/ratfs - 775 sys sys 1178568314 110177
@@ -5819,7 +5819,7 @@ sys/games - 20000000775 sys sys 1117225532 0
 sys/games/lib - 20000000775 sys sys 1165337608 0
 sys/games/lib/4scores - 10000000666 sys sys 1118680448 0
 sys/games/lib/5scores - 10000000666 sys sys 1118680453 0
-sys/games/lib/fortunes - 664 sys sys 1179445990 265143
+sys/games/lib/fortunes - 664 sys sys 1179957238 265482
 sys/games/lib/mahjongg - 20000000775 sys sys 1095792278 0
 sys/games/lib/mahjongg/backgrounds - 20000000775 sys sys 1095792293 0
 sys/games/lib/mahjongg/backgrounds/default.bit - 664 sys sys 1095792293 346803
@@ -8168,7 +8168,7 @@ sys/src/9/port/devcons.c - 664 sys sys 1176658321 22943
 sys/src/9/port/devdraw.c - 664 sys sys 1147023550 44447
 sys/src/9/port/devdup.c - 664 sys sys 1014931172 2332
 sys/src/9/port/devenv.c - 664 sys sys 1169498893 7015
-sys/src/9/port/devfs.c - 664 sys sys 1179726929 12395
+sys/src/9/port/devfs.c - 664 sys sys 1179951300 12209
 sys/src/9/port/devkbmap.c - 664 sys sys 1130763846 3064
 sys/src/9/port/devkprof.c - 664 sys sys 1014931173 3111
 sys/src/9/port/devloopback.c - 664 sys sys 1138458368 14579
@@ -14141,7 +14141,7 @@ sys/src/cmd/upas/bayes/msgtok.c - 664 sys sys 1063951010 4185
 sys/src/cmd/upas/bayes/regcomp.c - 664 sys sys 1063951010 9707
 sys/src/cmd/upas/bayes/regen.c - 664 sys sys 1063951011 2452
 sys/src/cmd/upas/common - 20000000775 sys sys 1075064534 0
-sys/src/cmd/upas/common/appendfiletombox.c - 664 sys sys 1075064534 2154
+sys/src/cmd/upas/common/appendfiletombox.c - 664 sys sys 1179946114 2563
 sys/src/cmd/upas/common/aux.c - 664 sys sys 1019498851 2300
 sys/src/cmd/upas/common/become.c - 664 sys sys 1015009623 430
 sys/src/cmd/upas/common/common.h - 664 sys sys 1098803897 2040

+ 5 - 0
dist/replica/plan9.log

@@ -49100,3 +49100,8 @@
 1179781224 2 c sys/src/cmd/ip/traceroute.c - 664 sys sys 1179779560 8645
 1179783024 0 c sys/src/cmd/ip/6in4.c - 664 sys sys 1179783180 7341
 1179804623 0 c 386/bin/ip/traceroute - 775 sys sys 1179804021 72750
+1179946824 0 c sys/src/cmd/upas/common/appendfiletombox.c - 664 sys sys 1179946114 2563
+1179952222 0 c sys/src/9/port/devfs.c - 664 sys sys 1179951300 12209
+1179957623 0 c sys/games/lib/fortunes - 664 sys sys 1179957238 265482
+1179977422 0 c 386/bin/upas/deliver - 775 sys sys 1179976975 99212
+1179977422 1 c 386/bin/upas/nedmail - 775 sys sys 1179976975 156013

+ 1 - 0
sys/games/lib/fortunes

@@ -4181,3 +4181,4 @@ Eta aquarid  meeteeor shouwer - astro -k
 The program 'apt-get' is currently not installed.  You can install it by typing: apt-get install apt  - ubuntu linux
 Subject: Re: [9fans] speaking of kenc... can you imagine a c compiler that does not translate to asm first? or can you imagine porting a c compiler when you dont have an assembler? -- Rogelio Serrano
 I expect to be quite wealthy once the dust from the Linux IPOs has settled.  - Eric Raymond, "Doing It For the Cause", December 1999
+A handful of characteristics of Unix are responsible for its resilience. First, Unix is simple: whereas some operating systems implement thousands of system calls and have unclear design goals, Unix systems typically implement only hundreds of system calls and have a very clear design. -- Linux Kernel Development, 2nd Ed. by Robert Love

+ 4 - 11
sys/src/9/port/devfs.c

@@ -369,7 +369,6 @@ mgen(Chan *c, char*, Dirtab*, int, int i, Dir *dp)
 static Chan*
 mattach(char *spec)
 {
-	*confstr = 0;
 	return devattach(fsdevtab.dc, spec);
 }
 
@@ -437,25 +436,19 @@ io(Fsdev *mp, Inner *in, int isread, void *a, long l, vlong off)
 	Chan *mc = in->idev;
 
 	if (waserror()) {
-		print("#k: %s byte %,lld (of %s): %s error: %s\n",
-			in->iname, off, mp->name, (isread? "read": "write"),
+		print("#k: %s byte %,lld count %ld (of #k/%s): %s error: %s\n",
+			in->iname, off, l, mp->name, (isread? "read": "write"),
 			(up && up->errstr? up->errstr: ""));
 		nexterror();
 	}
 	if (isread) {
 		wl = devtab[mc->type]->read(mc, a, l, off);
-		if (wl != l) {
-//			print("#k: %s byte %,lld (of %s): short read\n",
-//				in->iname, off, mp->name);
+		if (wl != l)
 			error("#k: short read");
-		}
 	} else {
 		wl = devtab[mc->type]->write(mc, a, l, off);
-		if (wl != l) {
-//			print("#k: %s byte %,lld (of %s): write error\n",
-//				in->iname, off, mp->name);
+		if (wl != l)
 			error("#k: write error");
-		}
 	}
 	poperror();
 	return wl;

+ 17 - 8
sys/src/cmd/upas/common/appendfiletombox.c

@@ -31,6 +31,7 @@ allocinbuf(int in, int out)
 	return b;
 }
 
+/* should only be called at start of file or when b->rp[-1] == '\n' */
 static int
 fill(Inbuf *b, int addspace)
 {
@@ -67,14 +68,14 @@ fill(Inbuf *b, int addspace)
 	return b->wp - b->rp;
 }
 
+enum { Fromlen = sizeof "From " - 1, };
+
 /* code to escape ' '*From' ' at the beginning of a line */
 int
 appendfiletombox(int in, int out)
 {
-	int addspace;
-	int n;
+	int addspace, n, sol;
 	char *p;
-	int sol;
 	Inbuf *b;
 
 	seek(out, 0, 2);
@@ -84,14 +85,22 @@ appendfiletombox(int in, int out)
 	sol = 1;
 
 	for(;;){
-		if(b->wp - b->rp < 5){
-			n = fill(b, addspace);
-			addspace = 0;
+		if(b->wp - b->rp < Fromlen){
+			/*
+			 * not enough unread bytes in buffer to match "From ",
+			 * so get some more.  We must only inject a space at
+			 * the start of a line (one that begins with "From ").
+			 */
+			if (b->rp == b->buf || b->rp[-1] == '\n') {
+				n = fill(b, addspace);
+				addspace = 0;
+			} else
+				n = fill(b, 0);
 			if(n < 0)
 				goto error;
 			if(n == 0)
 				break;
-			if(n < 5){
+			if(n < Fromlen){	/* still can't match? */
 				b->rp = b->wp;
 				continue;
 			}
@@ -108,7 +117,7 @@ appendfiletombox(int in, int out)
 			}
 			continue;
 		} else {
-			if(*b->rp == ' ' || strncmp(b->rp, "From ", 5) != 0){
+			if(*b->rp == ' ' || strncmp(b->rp, "From ", Fromlen) != 0){
 				b->rp++;
 				continue;
 			}