Browse Source

Plan 9 from Bell Labs 2005-06-16

David du Colombier 19 years ago
parent
commit
7066457a7e
8 changed files with 78 additions and 70 deletions
  1. 11 7
      dist/replica/_plan9.db
  2. 11 11
      dist/replica/plan9.db
  3. 12 0
      dist/replica/plan9.log
  4. 1 1
      sys/man/8/ndb
  5. 1 1
      sys/src/cmd/auth/changeuser.c
  6. 14 9
      sys/src/cmd/hget.c
  7. 2 2
      sys/src/games/4s.c
  8. 26 39
      sys/src/games/xs.h

+ 11 - 7
dist/replica/_plan9.db

@@ -5763,8 +5763,8 @@ sys/doc/venti/venti.pdf - 755 sys sys 1020384352 139090
 sys/doc/venti/venti.ps - 664 sys sys 1019852320 2012620
 sys/games - 20000000775 sys sys 952648872 0
 sys/games/lib - 20000000775 sys sys 952648879 0
-sys/games/lib/4scores - 664 sys sys 1118680448 0
-sys/games/lib/5scores - 664 sys sys 1118680453 0
+sys/games/lib/4scores - 10000000664 sys sys 1118680448 0
+sys/games/lib/5scores - 10000000664 sys sys 1118680453 0
 sys/games/lib/fortunes - 664 sys sys 1117193231 253904
 sys/games/lib/mahjongg - 20000000775 sys sys 1095792278 0
 sys/games/lib/mahjongg/backgrounds - 20000000775 sys sys 1095792293 0
@@ -7694,7 +7694,7 @@ sys/man/8/mkpaqfs - 664 sys sys 1018386778 892
 sys/man/8/mksacfs - 664 sys sys 964886843 710
 sys/man/8/mouse - 664 sys sys 971455511 2476
 sys/man/8/na - 664 sys sys 958527089 859
-sys/man/8/ndb - 664 sys sys 1117227905 9941
+sys/man/8/ndb - 664 sys sys 1118851681 9943
 sys/man/8/newuser - 664 sys sys 1116954242 2418
 sys/man/8/nfsserver - 664 sys sys 1017251291 3397
 sys/man/8/pcmcia - 664 sys sys 944959679 408
@@ -9424,7 +9424,7 @@ sys/src/cmd/auth/asn12rsa.c - 664 sys sys 1048614959 1192
 sys/src/cmd/auth/authcmdlib.h - 664 sys sys 1032497636 1438
 sys/src/cmd/auth/authsrv.c - 664 sys sys 1078839960 18395
 sys/src/cmd/auth/challenge.c - 664 sys sys 1015008432 980
-sys/src/cmd/auth/changeuser.c - 664 sys sys 1015008431 2933
+sys/src/cmd/auth/changeuser.c - 664 sys sys 1118884775 2932
 sys/src/cmd/auth/convbio.c - 664 sys sys 1015008432 2212
 sys/src/cmd/auth/convkeys.c - 664 sys sys 1015008430 2347
 sys/src/cmd/auth/convkeys2.c - 664 sys sys 1015008432 2401
@@ -11965,7 +11965,7 @@ sys/src/cmd/gzip/mkfile - 664 sys sys 984758036 125
 sys/src/cmd/gzip/unzip.c - 664 sys sys 1050689595 13603
 sys/src/cmd/gzip/zip.c - 664 sys sys 1033183074 7054
 sys/src/cmd/gzip/zip.h - 664 sys sys 954778719 1428
-sys/src/cmd/hget.c - 664 sys sys 1091129591 25650
+sys/src/cmd/hget.c - 664 sys sys 1118885209 25774
 sys/src/cmd/history.c - 664 sys sys 1116770200 6046
 sys/src/cmd/hoc - 20000000775 sys sys 954036932 0
 sys/src/cmd/hoc/code.c - 664 sys sys 944961000 10041
@@ -13865,7 +13865,7 @@ sys/src/fs/sony/mem.h - 664 sys sys 1015110103 2865
 sys/src/fs/sony/mkfile - 664 sys sys 1091803623 1594
 sys/src/fs/worms - 664 sys sys 1015110031 2806
 sys/src/games - 20000000775 sys sys 1095792091 0
-sys/src/games/4s.c - 664 sys sys 1118672529 1466
+sys/src/games/4s.c - 664 sys sys 1118885272 1466
 sys/src/games/5s.c - 664 sys sys 1118672529 3802
 sys/src/games/catback.p - 664 sys sys 1108184106 35763
 sys/src/games/catclock.c - 664 sys sys 1108184106 10354
@@ -13946,7 +13946,7 @@ sys/src/games/sudoku/levels.c - 664 sys sys 1117226433 3186
 sys/src/games/sudoku/mkfile - 664 sys sys 1117226432 218
 sys/src/games/sudoku/sudoku.c - 664 sys sys 1117636441 7809
 sys/src/games/sudoku/sudoku.h - 664 sys sys 1117226432 1159
-sys/src/games/xs.h - 664 sys sys 1118672529 14310
+sys/src/games/xs.h - 664 sys sys 1118886450 14271
 sys/src/lib9p - 20000000775 sys sys 1015023311 0
 sys/src/lib9p/_post.c - 664 sys sys 1103565871 1642
 sys/src/lib9p/dirread.c - 664 sys sys 1015023310 641
@@ -15051,3 +15051,7 @@ 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/games/4s - 775 sys sys 1118891246 175563
+386/bin/games/5s - 775 sys sys 1118891246 178075
+386/bin/hget - 775 sys sys 1118891247 231963
+386/bin/auth/changeuser - 775 sys sys 1118891246 97026

+ 11 - 11
dist/replica/plan9.db

@@ -46,7 +46,7 @@
 386/bin/auth/aescbc - 775 sys sys 1117249742 140735
 386/bin/auth/asn12rsa - 775 sys sys 1115950027 119644
 386/bin/auth/authsrv - 775 sys sys 1115950028 165463
-386/bin/auth/changeuser - 775 sys sys 1115950028 97026
+386/bin/auth/changeuser - 775 sys sys 1118891246 97026
 386/bin/auth/convkeys - 775 sys sys 1117249742 87396
 386/bin/auth/convkeys2 - 775 sys sys 1117249742 87447
 386/bin/auth/cron - 775 sys sys 1115950029 142890
@@ -245,8 +245,8 @@
 386/bin/fs/zipfs - 775 sys sys 1115950074 109088
 386/bin/ftpfs - 775 sys sys 1116903732 271518
 386/bin/games - 20000000775 sys sys 1096298711 0
-386/bin/games/4s - 775 sys sys 1118718525 175529
-386/bin/games/5s - 775 sys sys 1118718525 178065
+386/bin/games/4s - 775 sys sys 1118891246 175563
+386/bin/games/5s - 775 sys sys 1118891246 178075
 386/bin/games/catclock - 775 sys sys 1115950075 140798
 386/bin/games/juggle - 775 sys sys 1118202754 125319
 386/bin/games/jukebox - 775 sys sys 1105589128 264821
@@ -266,7 +266,7 @@
 386/bin/gview - 775 sys sys 1115950078 238067
 386/bin/gzip - 775 sys sys 1115950078 84762
 386/bin/hayes - 775 sys sys 1115950078 64556
-386/bin/hget - 775 sys sys 1115950079 231848
+386/bin/hget - 775 sys sys 1118891247 231963
 386/bin/history - 775 sys sys 1116903733 75357
 386/bin/hoc - 775 sys sys 1115950079 99875
 386/bin/html2ms - 775 sys sys 1115950079 66095
@@ -5763,8 +5763,8 @@ sys/doc/venti/venti.pdf - 755 sys sys 1020384352 139090
 sys/doc/venti/venti.ps - 664 sys sys 1019852320 2012620
 sys/games - 20000000775 sys sys 952648872 0
 sys/games/lib - 20000000775 sys sys 952648879 0
-sys/games/lib/4scores - 664 sys sys 1118680448 0
-sys/games/lib/5scores - 664 sys sys 1118680453 0
+sys/games/lib/4scores - 10000000664 sys sys 1118680448 0
+sys/games/lib/5scores - 10000000664 sys sys 1118680453 0
 sys/games/lib/fortunes - 664 sys sys 1117193231 253904
 sys/games/lib/mahjongg - 20000000775 sys sys 1095792278 0
 sys/games/lib/mahjongg/backgrounds - 20000000775 sys sys 1095792293 0
@@ -7694,7 +7694,7 @@ sys/man/8/mkpaqfs - 664 sys sys 1018386778 892
 sys/man/8/mksacfs - 664 sys sys 964886843 710
 sys/man/8/mouse - 664 sys sys 971455511 2476
 sys/man/8/na - 664 sys sys 958527089 859
-sys/man/8/ndb - 664 sys sys 1117227905 9941
+sys/man/8/ndb - 664 sys sys 1118851681 9943
 sys/man/8/newuser - 664 sys sys 1116954242 2418
 sys/man/8/nfsserver - 664 sys sys 1017251291 3397
 sys/man/8/pcmcia - 664 sys sys 944959679 408
@@ -9424,7 +9424,7 @@ sys/src/cmd/auth/asn12rsa.c - 664 sys sys 1048614959 1192
 sys/src/cmd/auth/authcmdlib.h - 664 sys sys 1032497636 1438
 sys/src/cmd/auth/authsrv.c - 664 sys sys 1078839960 18395
 sys/src/cmd/auth/challenge.c - 664 sys sys 1015008432 980
-sys/src/cmd/auth/changeuser.c - 664 sys sys 1015008431 2933
+sys/src/cmd/auth/changeuser.c - 664 sys sys 1118884775 2932
 sys/src/cmd/auth/convbio.c - 664 sys sys 1015008432 2212
 sys/src/cmd/auth/convkeys.c - 664 sys sys 1015008430 2347
 sys/src/cmd/auth/convkeys2.c - 664 sys sys 1015008432 2401
@@ -11965,7 +11965,7 @@ sys/src/cmd/gzip/mkfile - 664 sys sys 984758036 125
 sys/src/cmd/gzip/unzip.c - 664 sys sys 1050689595 13603
 sys/src/cmd/gzip/zip.c - 664 sys sys 1033183074 7054
 sys/src/cmd/gzip/zip.h - 664 sys sys 954778719 1428
-sys/src/cmd/hget.c - 664 sys sys 1091129591 25650
+sys/src/cmd/hget.c - 664 sys sys 1118885209 25774
 sys/src/cmd/history.c - 664 sys sys 1116770200 6046
 sys/src/cmd/hoc - 20000000775 sys sys 954036932 0
 sys/src/cmd/hoc/code.c - 664 sys sys 944961000 10041
@@ -13865,7 +13865,7 @@ sys/src/fs/sony/mem.h - 664 sys sys 1015110103 2865
 sys/src/fs/sony/mkfile - 664 sys sys 1091803623 1594
 sys/src/fs/worms - 664 sys sys 1015110031 2806
 sys/src/games - 20000000775 sys sys 1095792091 0
-sys/src/games/4s.c - 664 sys sys 1118672529 1466
+sys/src/games/4s.c - 664 sys sys 1118885272 1466
 sys/src/games/5s.c - 664 sys sys 1118672529 3802
 sys/src/games/catback.p - 664 sys sys 1108184106 35763
 sys/src/games/catclock.c - 664 sys sys 1108184106 10354
@@ -13946,7 +13946,7 @@ sys/src/games/sudoku/levels.c - 664 sys sys 1117226433 3186
 sys/src/games/sudoku/mkfile - 664 sys sys 1117226432 218
 sys/src/games/sudoku/sudoku.c - 664 sys sys 1117636441 7809
 sys/src/games/sudoku/sudoku.h - 664 sys sys 1117226432 1159
-sys/src/games/xs.h - 664 sys sys 1118672529 14310
+sys/src/games/xs.h - 664 sys sys 1118886450 14271
 sys/src/lib9p - 20000000775 sys sys 1015023311 0
 sys/src/lib9p/_post.c - 664 sys sys 1103565871 1642
 sys/src/lib9p/dirread.c - 664 sys sys 1015023310 641

+ 12 - 0
dist/replica/plan9.log

@@ -19490,3 +19490,15 @@
 1118682045 1 a sys/games/lib/5scores - 664 sys sys 1118680453 0
 1118719854 0 a 386/bin/games/4s - 775 sys sys 1118718525 175529
 1118719854 1 a 386/bin/games/5s - 775 sys sys 1118718525 178065
+1118853083 0 c sys/man/8/ndb - 664 sys sys 1118851681 9943
+1118885492 0 m sys/games/lib/4scores - 10000000664 sys sys 1118680448 0
+1118885492 1 m sys/games/lib/5scores - 10000000664 sys sys 1118680453 0
+1118885492 2 c sys/src/cmd/auth/changeuser.c - 664 sys sys 1118884775 2932
+1118885492 3 c sys/src/cmd/hget.c - 664 sys sys 1118885209 25774
+1118885492 4 c sys/src/games/4s.c - 664 sys sys 1118885272 1466
+1118885492 5 c sys/src/games/xs.h - 664 sys sys 1118885367 14270
+1118887290 0 c sys/src/games/xs.h - 664 sys sys 1118886450 14271
+1118892691 0 c 386/bin/games/4s - 775 sys sys 1118891246 175563
+1118892691 1 c 386/bin/games/5s - 775 sys sys 1118891246 178075
+1118892691 2 c 386/bin/hget - 775 sys sys 1118891247 231963
+1118892691 3 c 386/bin/auth/changeuser - 775 sys sys 1118891246 97026

+ 1 - 1
sys/man/8/ndb

@@ -314,7 +314,7 @@ that are under this root.  For example
 
 dom=ns1.cs.bell-labs.com ip=135.104.1.11
 .EE
-will automaticly create both forward and reverse entries for
+will automatically create both forward and reverse entries for
 .B ns1.cs.bell-labs.com .
 Unlike other DNS servers, there's no way to generate
 inconsistent forward and reverse entries.

+ 1 - 1
sys/src/cmd/auth/changeuser.c

@@ -10,7 +10,7 @@ int	exists (char*, char*);
 void
 usage(void)
 {
-	fprint(2, "usage: changeuser [-pnm] user\n");
+	fprint(2, "usage: changeuser [-pn] user\n");
 	exits("usage");
 }
 

+ 14 - 9
sys/src/cmd/hget.c

@@ -92,7 +92,7 @@ struct {
 void
 usage(void)
 {
-	fprint(2, "usage: %s [-hv] [-o outfile] [-p body] [-x netmtpt] url\n", argv0);
+	fprint(2, "usage: %s [-dhv] [-o outfile] [-p body] [-x netmtpt] url\n", argv0);
 	exits("usage");
 }
 
@@ -387,10 +387,8 @@ dohttp(URL *u, URL *px, Range *r, Out *out, long mtime)
 					"Host: %s\r\n"
 					"Content-type: application/x-www-form-urlencoded\r\n"
 					"Content-length: %d\r\n"
-					"User-agent: Plan9/hget\r\n"
-					"\r\n",
+					"User-agent: Plan9/hget\r\n",
 					u->page, u->host, strlen(u->postbody));
-			dfprint(fd,	"%s", u->postbody);
 		}
 		if(r->start != 0){
 			dfprint(fd, "Range: bytes=%d-\n", r->start);
@@ -417,6 +415,8 @@ dohttp(URL *u, URL *px, Range *r, Out *out, long mtime)
 		}
 			
 		dfprint(fd, "\r\n", u->host);
+		if(u->postbody)
+			dfprint(fd,	"%s", u->postbody);
 
 		auth = 0;
 		redirect = 0;
@@ -758,10 +758,11 @@ hhcrange(char *p, URL*, Range *r)
 	x = strchr(p, '/');
 	if(x)
 		l = atoll(x+1);
-	if(l == 0)
-	x = strchr(p, '-');
-	if(x)
-		l = atoll(x+1);
+	if(l == 0) {
+		x = strchr(p, '-');
+		if(x)
+			l = atoll(x+1);
+	}
 	if(l)
 		r->end = l;
 }
@@ -842,7 +843,7 @@ doftp(URL *u, URL *px, Range *r, Out *out, long mtime)
 	char conndir[NETPATHLEN];
 	char *p;
 
-	/* untested, proxy dosn't work with ftp (I think) */
+	/* untested, proxy doesn't work with ftp (I think) */
 	if(px->host == nil){
 		ctl = dial(netmkaddr(u->host, tcpdir, u->port), 0, conndir, 0);
 	} else {
@@ -1417,6 +1418,10 @@ setoffset(Out *out, int offset)
 	else
 		out->curr = nil;
 	out->offset = offset;
+	out->written = offset;
+	if(ofile != nil)
+		if(seek(out->fd, offset, 0) != offset)
+			sysfatal("seek: %r");
 }
 
 /*

+ 2 - 2
sys/src/games/4s.c

@@ -17,9 +17,9 @@ struct Piece{
 
 Piece pieces[]={
 	{ 0, 0, 4,1,  { 0,0,  1,0,  1,0,  1,0 }},
-	{ 1, 0, 2,4,  { 1,0,  0,1,  0,1,  0,1 }},
+	{ 1, 0, 1,4,  { 0,0,  0,1,  0,1,  0,1 }},
 	{ 2, 0, 4,1,  { 0,0,  1,0,  1,0,  1,0 }},
-	{ 3, 0, 2,4,  { 1,0,  0,1,  0,1,  0,1 }},
+	{ 3, 0, 1,4,  { 0,0,  0,1,  0,1,  0,1 }},
 
 	{ 0, 1, 3,2,  { 0,0,  1,0,  1,0,  0,1 }},
 	{ 1, 1, 2,3,  { 1,0,  0,1,  0,1, -1,0 }},

+ 26 - 39
sys/src/games/xs.h

@@ -30,6 +30,7 @@ Point		scoresz;
 int		pcsz = 32;
 Point		pos;
 Image	*bb, *bbmask, *bb2, *bb2mask;
+Image	*whitemask;
 Rectangle	br, br2;
 long		points;
 int		dt;
@@ -239,7 +240,7 @@ canfit(Piece *p)
 	Point z;
 
 	j = N + 1;
-	if(N > 4){
+	if(j >= 4){
 		j = p->sz.x;
 		if(j<p->sz.y)
 			j = p->sz.y;
@@ -309,6 +310,7 @@ choosepiece(void)
 		pos.x += nrand(NX)*pcsz;
 	}while(collide(Pt(pos.x, pos.y+pcsz-DY), piece));
 	drawpiece();
+	moveto(mousectl, Pt(rboard.min.x + Dx(rboard)/2, rboard.min.y +Dy(rboard)/2));
 	flushimage(display, 1);
 }
 
@@ -344,7 +346,6 @@ horiz(void)
 	int lev[N];
 	int i, j, h;
 	Rectangle r;
-	Image *col;
 
 	h = 0;
 	for(i=0; i<NY; i++){
@@ -361,20 +362,19 @@ horiz(void)
 	for(j=0; j<h; j++){
 		r.min.y = rboard.min.y + lev[j]*pcsz;
 		r.max.y = r.min.y + pcsz;
-		draw(screen, r, display->white, nil, ZP);
+		draw(screen, r, display->white, whitemask, ZP);
 		flushimage(display, 1);
 	}
-	for(i=0; i<6; i++){
+	for(i=0; i<5; i++){
 		pause(500);
 		if(newscreen){
 			drawboard();
 			break;
 		}
-		col = (i&1)? display->white : display->black;
 		for(j=0; j<h; j++){
 			r.min.y = rboard.min.y + lev[j]*pcsz;
 			r.max.y = r.min.y + pcsz;
-			draw(screen, r, col, nil, ZP);
+			draw(screen, r, display->white, whitemask, ZP);
 		}
 		flushimage(display, 1);
 	}
@@ -624,10 +624,8 @@ redraw(int new)
 	Rectangle r;
 	long dx, dy;
 
-	if(new && getwindow(display, Refmesg) < 0){
-		fprint(2, "can't reattach to window");
-		exits("redraw");
-	}
+	if(new && getwindow(display, Refmesg) < 0)
+		sysfatal("can't reattach to window");
 	r = screen->r;
 	pos.x = (pos.x - rboard.min.x) / pcsz;
 	pos.y = (pos.y - rboard.min.y) / pcsz;
@@ -641,11 +639,8 @@ redraw(int new)
 		DY = 4;
 	pcsz = DY*8;
 	DMOUSE = pcsz/3;
-	if(pcsz < 8){
-		fprint(2, "screen too small: %d\n", pcsz);
-		threadexitsall(nil);
-		exits("too small");
-	}
+	if(pcsz < 8)
+		sysfatal("screen too small: %d", pcsz);
 	rboard = screen->r;
 	rboard.min.x += (dx-pcsz*NX)/2;
 	rboard.min.y += (dy-pcsz*NY)/2+32;
@@ -666,10 +661,8 @@ redraw(int new)
 	bbmask = allocimage(display, Rect(0,0,N*pcsz,N*pcsz), GREY1, 0, 0);
 	bb2 = allocimage(display, Rect(0,0,N*pcsz,N*pcsz+DY), screen->chan, 0, 0);
 	bb2mask = allocimage(display, bb2->r, GREY1, 0, 0);
-	if(bb==0 || bbmask==0 || bb2==0 || bb2mask==0){
-		fprint(2, "allocimage fail (bb)\n");
-		exits("allocimage");
-	}
+	if(bb==0 || bbmask==0 || bb2==0 || bb2mask==0)
+		sysfatal("allocimage fail (bb)");
 	draw(screen, screen->r, display->white, nil, ZP);
 	drawboard();
 	setpiece(piece);
@@ -695,37 +688,27 @@ threadmain(int argc, char *argv[])
 	snprint(buf, sizeof(buf), "%ds", N);
 	initdraw(0, 0, buf);
 	mousectl = initmouse(nil, display->image);	/* BUG? */
-	if(mousectl == nil){
-		fprint(2, "[45]s: mouse init failed: %r\n");
-		exits("mouse");
-	}
+	if(mousectl == nil)
+		sysfatal("[45]s: mouse init failed: %r");
 	keyboardctl = initkeyboard(nil);	/* BUG? */
-	if(keyboardctl == nil){
-		fprint(2, "[45]s: keyboard init failed: %r\n");
-		exits("kbd");
-	}
+	if(keyboardctl == nil)
+		sysfatal("[45]s: keyboard init failed: %r");
 	starttime = time(0);
 	srand(starttime);
 	snprint(buf, sizeof(buf), "/sys/games/lib/%dscores", N);
 	scores = open(buf, OWRITE);
-	if(scores < 0){
-		fprint(2, "can't open %s\n", buf);
-		exits("scores file");
-	}
+	if(scores < 0)
+		sysfatal("can't open %s: %r", buf);
 	tb = 0;
 	if(screen->depth < 3){
 		tb = allocimage(display, Rect(0,0,16,16), 0, 1, -1);
-		if(tb == 0){
-			fprint(2, "allocimage fail (tb)\n");
-			exits("allocimage");
-		}
+		if(tb == 0)
+			sysfatal("allocimage fail (tb)");
 	}
 	for(i = 0; i<NCOL; i++){
 		tx[i] = allocimage(display, Rect(0, 0, 16, 16), screen->chan, 1, txpix[i]);
-		if(tx[i] == 0){
-			fprint(2, "allocimage fail (tx)\n");
-			exits("allocimage");
-		}
+		if(tx[i] == 0)
+			sysfatal("allocimage fail (tx)");
 		if(screen->depth < 3){
 			loadimage(tb, tb->r, txbits[i], 32);
 			draw(tx[i], tx[i]->r, tb, nil, ZP);
@@ -734,6 +717,10 @@ threadmain(int argc, char *argv[])
 	if(tb != 0)
 		freeimage(tb);
 
+	whitemask = allocimage(display, Rect(0,0,1,1), CMAP8, 1, setalpha(DWhite, 0x7F));
+	if(whitemask==0)
+		sysfatal("allocimage fail (whitemask)");
+
 	threadsetname("4s-5s");
 	timerc= chancreate(sizeof(int), 0);
 	proccreate(timerproc, timerc, 1024);