Browse Source

Plan 9 from Bell Labs 2006-02-10

David du Colombier 16 years ago
parent
commit
37c391a477
7 changed files with 56 additions and 21 deletions
  1. 5 5
      dist/replica/_plan9.db
  2. 1 1
      dist/replica/network
  3. 5 5
      dist/replica/plan9.db
  4. 5 0
      dist/replica/plan9.log
  5. 2 2
      rc/bin/9fs
  6. 26 0
      sys/src/cmd/awk/lib.c
  7. 12 8
      sys/src/cmd/awk/run.c

+ 5 - 5
dist/replica/_plan9.db

@@ -155,7 +155,7 @@
 386/bin/aux/write - 775 sys sys 1085077011 4188
 386/bin/aux/zerotrunc - 775 sys sys 1108268388 3891
 386/bin/awd - 775 sys sys 1135570793 58734
-386/bin/awk - 775 sys sys 1136656332 321786
+386/bin/awk - 775 sys sys 1139507857 324417
 386/bin/basename - 775 sys sys 1130384262 37902
 386/bin/bc - 775 sys sys 1135570793 81760
 386/bin/bind - 775 sys sys 1135570793 59562
@@ -872,7 +872,7 @@ dist - 20000000775 sys sys 1017437778 0
 dist/replica - 20000000775 sys sys 1019277119 0
 dist/replica/cd - 664 sys sys 1019527959 390
 dist/replica/kfs - 664 sys sys 1019527929 237
-dist/replica/network - 775 sys sys 1071079179 996
+dist/replica/network - 775 sys sys 1139499513 956
 dist/replica/plan9.proto - 664 sys sys 1114460221 2560
 env - 20000000775 sys sys 1015094872 0
 fd - 20000000775 sys sys 947958544 0
@@ -5392,7 +5392,7 @@ power/mkfile - 664 sys sys 948141304 46
 rc - 20000000775 sys sys 944959447 0
 rc/bin - 20000000775 sys sys 1018637942 0
 rc/bin/9fat: - 775 sys sys 1133179689 367
-rc/bin/9fs - 775 sys sys 1138385380 986
+rc/bin/9fs - 775 sys sys 1139499615 971
 rc/bin/B - 775 sys sys 945617206 645
 rc/bin/C - 775 sys sys 1127395076 855
 rc/bin/Kill - 775 sys sys 1018637942 115
@@ -9736,7 +9736,7 @@ sys/src/cmd/awk - 20000000775 sys sys 944964677 0
 sys/src/cmd/awk/awk.h - 664 sys sys 944960803 4624
 sys/src/cmd/awk/awkgram.y - 664 sys sys 944960803 13930
 sys/src/cmd/awk/lex.c - 664 sys sys 944960803 12346
-sys/src/cmd/awk/lib.c - 664 sys sys 950315704 16241
+sys/src/cmd/awk/lib.c - 664 sys sys 1139499813 16722
 sys/src/cmd/awk/main.c - 664 sys sys 1134233061 5281
 sys/src/cmd/awk/maketab.c - 664 sys sys 944960802 5101
 sys/src/cmd/awk/mkfile - 664 sys sys 1036687332 955
@@ -9744,7 +9744,7 @@ sys/src/cmd/awk/parse.c - 664 sys sys 944960802 5068
 sys/src/cmd/awk/proctab.c - 664 sys sys 944960803 5123
 sys/src/cmd/awk/proto.h - 664 sys sys 944960802 6159
 sys/src/cmd/awk/re.c - 664 sys sys 964456820 6987
-sys/src/cmd/awk/run.c - 664 sys sys 1036687054 42680
+sys/src/cmd/awk/run.c - 664 sys sys 1139499813 42772
 sys/src/cmd/awk/tran.c - 664 sys sys 944960802 11855
 sys/src/cmd/basename.c - 664 sys sys 944961619 605
 sys/src/cmd/bc.y - 664 sys sys 1134233060 13455

+ 1 - 1
dist/replica/network

@@ -5,7 +5,7 @@ serverroot=/n/dist
 serverlog=$s/plan9.log
 serverproto=$s/plan9.proto
 fn servermount {
-	srv tcp!sources.cs.bell-labs.com sources /n/sources
+	9fs sources
 	bind /n/sources/plan9 /n/dist
 }
 fn serverupdate { status='' }

+ 5 - 5
dist/replica/plan9.db

@@ -155,7 +155,7 @@
 386/bin/aux/write - 775 sys sys 1085077011 4188
 386/bin/aux/zerotrunc - 775 sys sys 1108268388 3891
 386/bin/awd - 775 sys sys 1135570793 58734
-386/bin/awk - 775 sys sys 1136656332 321786
+386/bin/awk - 775 sys sys 1139507857 324417
 386/bin/basename - 775 sys sys 1130384262 37902
 386/bin/bc - 775 sys sys 1135570793 81760
 386/bin/bind - 775 sys sys 1135570793 59562
@@ -872,7 +872,7 @@ dist - 20000000775 sys sys 1017437778 0
 dist/replica - 20000000775 sys sys 1019277119 0
 dist/replica/cd - 664 sys sys 1019527959 390
 dist/replica/kfs - 664 sys sys 1019527929 237
-dist/replica/network - 775 sys sys 1071079179 996
+dist/replica/network - 775 sys sys 1139499513 956
 dist/replica/plan9.proto - 664 sys sys 1114460221 2560
 env - 20000000775 sys sys 1015094872 0
 fd - 20000000775 sys sys 947958544 0
@@ -5392,7 +5392,7 @@ power/mkfile - 664 sys sys 948141304 46
 rc - 20000000775 sys sys 944959447 0
 rc/bin - 20000000775 sys sys 1018637942 0
 rc/bin/9fat: - 775 sys sys 1133179689 367
-rc/bin/9fs - 775 sys sys 1138385380 986
+rc/bin/9fs - 775 sys sys 1139499615 971
 rc/bin/B - 775 sys sys 945617206 645
 rc/bin/C - 775 sys sys 1127395076 855
 rc/bin/Kill - 775 sys sys 1018637942 115
@@ -9736,7 +9736,7 @@ sys/src/cmd/awk - 20000000775 sys sys 944964677 0
 sys/src/cmd/awk/awk.h - 664 sys sys 944960803 4624
 sys/src/cmd/awk/awkgram.y - 664 sys sys 944960803 13930
 sys/src/cmd/awk/lex.c - 664 sys sys 944960803 12346
-sys/src/cmd/awk/lib.c - 664 sys sys 950315704 16241
+sys/src/cmd/awk/lib.c - 664 sys sys 1139499813 16722
 sys/src/cmd/awk/main.c - 664 sys sys 1134233061 5281
 sys/src/cmd/awk/maketab.c - 664 sys sys 944960802 5101
 sys/src/cmd/awk/mkfile - 664 sys sys 1036687332 955
@@ -9744,7 +9744,7 @@ sys/src/cmd/awk/parse.c - 664 sys sys 944960802 5068
 sys/src/cmd/awk/proctab.c - 664 sys sys 944960803 5123
 sys/src/cmd/awk/proto.h - 664 sys sys 944960802 6159
 sys/src/cmd/awk/re.c - 664 sys sys 964456820 6987
-sys/src/cmd/awk/run.c - 664 sys sys 1036687054 42680
+sys/src/cmd/awk/run.c - 664 sys sys 1139499813 42772
 sys/src/cmd/awk/tran.c - 664 sys sys 944960802 11855
 sys/src/cmd/basename.c - 664 sys sys 944961619 605
 sys/src/cmd/bc.y - 664 sys sys 1134233060 13455

+ 5 - 0
dist/replica/plan9.log

@@ -27527,3 +27527,8 @@
 1138984207 1 c 386/lib/libdisk.a - 664 sys sys 1138982896 42414
 1139443218 0 c sys/src/cmd/faces/facedb.c - 664 sys sys 1139442044 10555
 1139457624 0 c 386/bin/faces - 775 sys sys 1139457581 194170
+1139500835 0 c rc/bin/9fs - 775 sys sys 1139499615 971
+1139500835 1 c sys/src/cmd/awk/lib.c - 664 sys sys 1139499813 16722
+1139500835 2 c sys/src/cmd/awk/run.c - 664 sys sys 1139499813 42772
+1139500835 3 c dist/replica/network - 775 sys sys 1139499513 956
+1139508036 0 c 386/bin/awk - 775 sys sys 1139507857 324417

+ 2 - 2
rc/bin/9fs

@@ -20,8 +20,8 @@ case other
 case juke
 	srv -q il!jukefs && mount /srv/il!jukefs /n/njuke && bind -c /n/njuke/juke /n/juke
 case sources
-	srv -q tcp!sources.cs.bell-labs.com sources /n/sources &&
-		mount -n /srv/sources /n/sources
+	srv -q tcp!sources.cs.bell-labs.com sources
+	mount -n /srv/sources /n/sources
 case sourcesdump
 	9fs sources
 	mount /srv/sources /n/sourcesdump main/archive

+ 26 - 0
sys/src/cmd/awk/lib.c

@@ -673,6 +673,32 @@ int is_number(char *s)
 {
 	double r;
 	char *ep;
+
+	/*
+	 * fast could-it-be-a-number check before calling strtod,
+	 * which takes a surprisingly long time to reject non-numbers.
+	 */
+	switch (*s) {
+	case '0': case '1': case '2': case '3': case '4':
+	case '5': case '6': case '7': case '8': case '9':
+	case '\t':
+	case '\n':
+	case '\v':
+	case '\f':
+	case '\r':
+	case ' ':
+	case '-':
+	case '+':
+	case '.':
+	case 'n':		/* nans */
+	case 'N':
+	case 'i':		/* infs */
+	case 'I':
+		break;
+	default:
+		return 0;	/* can't be a number */
+	}
+
 	errno = 0;
 	r = strtod(s, &ep);
 	if (ep == s || r == HUGE_VAL || errno == ERANGE)

+ 12 - 8
sys/src/cmd/awk/run.c

@@ -133,6 +133,7 @@ void run(Node *a)	/* execution of parse tree starts here */
 
 Cell *execute(Node *u)	/* execute a node of the parse tree */
 {
+	int nobj;
 	Cell *(*proc)(Node **, int);
 	Cell *x;
 	Node *a;
@@ -149,10 +150,11 @@ Cell *execute(Node *u)	/* execute a node of the parse tree */
 				recbld();
 			return(x);
 		}
-		if (notlegal(a->nobj))	/* probably a Cell* but too risky to print */
+		nobj = a->nobj;
+		if (notlegal(nobj))	/* probably a Cell* but too risky to print */
 			FATAL("illegal statement");
-		proc = proctab[a->nobj-FIRSTTOKEN];
-		x = (*proc)(a->narg, a->nobj);
+		proc = proctab[nobj-FIRSTTOKEN];
+		x = (*proc)(a->narg, nobj);
 		if (isfld(x) && !donefld)
 			fldbld();
 		else if (isrec(x) && !donerec)
@@ -1540,6 +1542,7 @@ Cell *bltin(Node **a, int n)	/* builtin functions. a[0] is type, a[1] is arg lis
 
 Cell *printstat(Node **a, int n)	/* print a[0] */
 {
+	int r;
 	Node *x;
 	Cell *y;
 	FILE *fp;
@@ -1553,14 +1556,15 @@ Cell *printstat(Node **a, int n)	/* print a[0] */
 		fputs(getsval(y), fp);
 		tempfree(y);
 		if (x->nnext == NULL)
-			fputs(*ORS, fp);
+			r = fputs(*ORS, fp);
 		else
-			fputs(*OFS, fp);
+			r = fputs(*OFS, fp);
+		if (r == EOF)
+			FATAL("write error on %s", filename(fp));
 	}
 	if (a[1] != 0)
-		fflush(fp);
-	if (ferror(fp))
-		FATAL("write error on %s", filename(fp));
+		if (fflush(fp) == EOF)
+			FATAL("write error on %s", filename(fp));
 	return(True);
 }