Browse Source

Plan 9 from Bell Labs 2004-12-02

David du Colombier 17 years ago
parent
commit
e9aad0f78b

+ 17 - 10
dist/replica/_plan9.db

@@ -5288,7 +5288,7 @@ sys/src/9/ip/icmp6.c - 664 sys sys 1047260563 18098
 sys/src/9/ip/igmp.c - 664 sys sys 1055700768 5175
 sys/src/9/ip/il.c - 664 sys sys 1077376217 26959
 sys/src/9/ip/inferno.c - 664 sys sys 1022588098 517
-sys/src/9/ip/ip.c - 664 sys sys 1047951326 15285
+sys/src/9/ip/ip.c - 664 sys sys 1101906449 15285
 sys/src/9/ip/ip.h - 664 sys sys 1091904429 15818
 sys/src/9/ip/ipaux.c - 664 sys sys 1079538100 12862
 sys/src/9/ip/ipifc.c - 664 sys sys 1091733773 34267
@@ -6785,14 +6785,14 @@ sys/src/cmd/acid/print.c - 664 sys sys 984756705 6840
 sys/src/cmd/acid/proc.c - 664 sys sys 1014924908 4513
 sys/src/cmd/acid/util.c - 664 sys sys 944960738 4297
 sys/src/cmd/acme - 20000000775 sys sys 969511023 0
-sys/src/cmd/acme/acme.c - 664 sys sys 1097972699 19493
+sys/src/cmd/acme/acme.c - 664 sys sys 1101910760 19489
 sys/src/cmd/acme/addr.c - 664 sys sys 1018553456 4787
 sys/src/cmd/acme/buff.c - 664 sys sys 1014926092 5573
 sys/src/cmd/acme/cols.c - 664 sys sys 1079102914 11126
-sys/src/cmd/acme/dat.h - 664 sys sys 1097972700 11144
+sys/src/cmd/acme/dat.h - 664 sys sys 1101910760 11143
 sys/src/cmd/acme/disk.c - 664 sys sys 1014926093 2151
 sys/src/cmd/acme/ecmd.c - 664 sys sys 1077376256 24294
-sys/src/cmd/acme/edit.c - 664 sys sys 1015701171 12055
+sys/src/cmd/acme/edit.c - 664 sys sys 1101910761 12068
 sys/src/cmd/acme/edit.h - 664 sys sys 969500816 2466
 sys/src/cmd/acme/elog.c - 664 sys sys 1078839859 7236
 sys/src/cmd/acme/exec.c - 664 sys sys 1099329953 28183
@@ -6802,7 +6802,7 @@ sys/src/cmd/acme/fsys.c - 664 sys sys 1079102915 12799
 sys/src/cmd/acme/look.c - 664 sys sys 1077376257 14213
 sys/src/cmd/acme/mkfile - 664 sys sys 1058463682 543
 sys/src/cmd/acme/regx.c - 664 sys sys 1014926094 16057
-sys/src/cmd/acme/rows.c - 664 sys sys 1084542482 14664
+sys/src/cmd/acme/rows.c - 664 sys sys 1101910761 14683
 sys/src/cmd/acme/scrl.c - 664 sys sys 1014926095 3072
 sys/src/cmd/acme/text.c - 664 sys sys 1099500744 27642
 sys/src/cmd/acme/time.c - 664 sys sys 1014926095 1783
@@ -7531,7 +7531,7 @@ sys/src/cmd/fax/receive.c - 664 sys sys 944960990 1097
 sys/src/cmd/fax/receiverc - 775 sys sys 944960990 581
 sys/src/cmd/fax/send.c - 664 sys sys 944960990 923
 sys/src/cmd/fax/subr.c - 664 sys sys 1015090401 1245
-sys/src/cmd/file.c - 664 sys sys 1084471672 21379
+sys/src/cmd/file.c - 664 sys sys 1101909618 22781
 sys/src/cmd/fmt.c - 664 sys sys 1070032009 4088
 sys/src/cmd/fortune.c - 664 sys sys 1072729222 1779
 sys/src/cmd/fossil - 20000000775 sys sys 1042005512 0
@@ -10435,7 +10435,7 @@ sys/src/cmd/tapefs/v10fs.c - 664 sys sys 1014926385 3754
 sys/src/cmd/tapefs/v6fs.c - 664 sys sys 1014926385 3971
 sys/src/cmd/tapefs/zip.h - 664 sys sys 1097914153 1428
 sys/src/cmd/tapefs/zipfs.c - 664 sys sys 1097900277 6803
-sys/src/cmd/tar.c - 664 sys sys 1094598836 15585
+sys/src/cmd/tar.c - 664 sys sys 1101909630 15630
 sys/src/cmd/tbl - 20000000775 sys sys 954038038 0
 sys/src/cmd/tbl/mkfile - 664 sys sys 944961243 268
 sys/src/cmd/tbl/t.h - 664 sys sys 944961244 3987
@@ -10936,11 +10936,11 @@ sys/src/cmd/usb/audio/audiosub.c - 664 sys sys 1100568596 6967
 sys/src/cmd/usb/audio/mkfile - 664 sys sys 1091204980 349
 sys/src/cmd/usb/audio/usbaudio.c - 664 sys sys 1100619443 9818
 sys/src/cmd/usb/audio/usbaudio.h - 664 sys sys 1100568597 1861
-sys/src/cmd/usb/audio/usbaudioctl.c - 664 sys sys 1100568597 17264
+sys/src/cmd/usb/audio/usbaudioctl.c - 664 sys sys 1101906325 17266
 sys/src/cmd/usb/audio/usbaudioctl.h - 664 sys sys 1100568597 600
 sys/src/cmd/usb/lib - 20000000775 sys sys 1018369393 0
 sys/src/cmd/usb/lib/device.c - 664 sys sys 1099760882 2968
-sys/src/cmd/usb/lib/dump.c - 664 sys sys 1099760882 12704
+sys/src/cmd/usb/lib/dump.c - 664 sys sys 1101906317 12757
 sys/src/cmd/usb/lib/fmt.c - 664 sys sys 1091204978 291
 sys/src/cmd/usb/lib/mkfile - 664 sys sys 1091204979 204
 sys/src/cmd/usb/lib/setup.c - 664 sys sys 1091204978 1953
@@ -11904,7 +11904,7 @@ sys/src/libflate/zlib.h - 664 sys sys 984709217 219
 sys/src/libframe - 20000000775 sys sys 944961726 0
 sys/src/libframe/frbox.c - 664 sys sys 1078466650 3028
 sys/src/libframe/frdelete.c - 664 sys sys 944961726 3079
-sys/src/libframe/frdraw.c - 664 sys sys 945275945 3277
+sys/src/libframe/frdraw.c - 664 sys sys 1101910634 3271
 sys/src/libframe/frinit.c - 664 sys sys 1019498851 1761
 sys/src/libframe/frinsert.c - 664 sys sys 984709939 6700
 sys/src/libframe/frptofchar.c - 664 sys sys 944961726 1995
@@ -12394,3 +12394,10 @@ usr/glenda/lib/profile - 664 glenda glenda 1021580005 847
 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/acme - 775 sys sys 1101960674 425079
+386/bin/usb/usbaudio - 775 sys sys 1101960675 183323
+386/bin/usb/usbd - 775 sys sys 1101960675 127706
+386/bin/file - 775 sys sys 1101960674 110319
+386/bin/aux/samterm - 775 sys sys 1101960674 245747
+386/bin/tar - 775 sys sys 1101960675 81834
+386/lib/libframe.a - 664 sys sys 1101960676 66060

+ 17 - 17
dist/replica/plan9.db

@@ -20,7 +20,7 @@
 386/bin/9660srv - 775 sys sys 1085076971 101995
 386/bin/aan - 775 sys sys 1085076971 128820
 386/bin/acid - 775 sys sys 1091936087 353717
-386/bin/acme - 775 sys sys 1100579339 425046
+386/bin/acme - 775 sys sys 1101960674 425079
 386/bin/ape - 20000000775 sys sys 1016944144 0
 386/bin/ape/basename - 775 sys sys 1087442501 132681
 386/bin/ape/cc - 775 sys sys 1085076973 68304
@@ -132,7 +132,7 @@
 386/bin/aux/posttek - 775 sys sys 1087442508 163239
 386/bin/aux/rdwr - 775 sys sys 1085077003 38275
 386/bin/aux/reboot - 775 sys sys 1085077004 58332
-386/bin/aux/samterm - 775 sys sys 1085077004 245843
+386/bin/aux/samterm - 775 sys sys 1101960674 245747
 386/bin/aux/searchfs - 775 sys sys 1085077005 87587
 386/bin/aux/sprog - 775 sys sys 1085077006 77357
 386/bin/aux/ssh_genkey - 775 sys sys 1045537957 194629
@@ -220,7 +220,7 @@
 386/bin/ext2srv - 775 sys sys 1089397312 171855
 386/bin/faces - 775 sys sys 1098158504 190538
 386/bin/factor - 775 sys sys 1085077042 59443
-386/bin/file - 775 sys sys 1091936091 108649
+386/bin/file - 775 sys sys 1101960674 110319
 386/bin/fmt - 775 sys sys 1085077043 63269
 386/bin/fortune - 775 sys sys 1085077045 65146
 386/bin/fossil - 20000000775 sys sys 1042005470 0
@@ -401,7 +401,7 @@
 386/bin/swap - 775 sys sys 1085077102 60111
 386/bin/syscall - 775 sys sys 1091849700 71497
 386/bin/tail - 775 sys sys 1085077102 63945
-386/bin/tar - 775 sys sys 1094612761 81786
+386/bin/tar - 775 sys sys 1101960675 81834
 386/bin/tbl - 775 sys sys 1085077103 111047
 386/bin/tcs - 775 sys sys 1085077103 256506
 386/bin/tee - 775 sys sys 1085077104 38401
@@ -458,8 +458,8 @@
 386/bin/upas/unspam - 775 sys sys 1064598367 38
 386/bin/upas/vf - 775 sys sys 1087873352 90619
 386/bin/usb - 20000000775 sys sys 1019538890 0
-386/bin/usb/usbaudio - 775 sys sys 1100664617 183278
-386/bin/usb/usbd - 775 sys sys 1099800617 127661
+386/bin/usb/usbaudio - 775 sys sys 1101960675 183323
+386/bin/usb/usbd - 775 sys sys 1101960675 127706
 386/bin/usb/usbmouse - 775 sys sys 1099800618 138206
 386/bin/usb/usbprinter - 775 sys sys 1089408719 222
 386/bin/vac - 775 sys sys 1085077119 167554
@@ -533,7 +533,7 @@
 386/lib/libdisk.a - 664 sys sys 1091936103 42234
 386/lib/libdraw.a - 664 sys sys 1098158576 373544
 386/lib/libflate.a - 664 sys sys 1089397329 76872
-386/lib/libframe.a - 664 sys sys 1098158576 66084
+386/lib/libframe.a - 664 sys sys 1101960676 66060
 386/lib/libgeometry.a - 664 sys sys 1098158576 50470
 386/lib/libhtml.a - 664 sys sys 1098158577 219972
 386/lib/libhttpd.a - 664 sys sys 1091936105 99488
@@ -5288,7 +5288,7 @@ sys/src/9/ip/icmp6.c - 664 sys sys 1047260563 18098
 sys/src/9/ip/igmp.c - 664 sys sys 1055700768 5175
 sys/src/9/ip/il.c - 664 sys sys 1077376217 26959
 sys/src/9/ip/inferno.c - 664 sys sys 1022588098 517
-sys/src/9/ip/ip.c - 664 sys sys 1047951326 15285
+sys/src/9/ip/ip.c - 664 sys sys 1101906449 15285
 sys/src/9/ip/ip.h - 664 sys sys 1091904429 15818
 sys/src/9/ip/ipaux.c - 664 sys sys 1079538100 12862
 sys/src/9/ip/ipifc.c - 664 sys sys 1091733773 34267
@@ -6785,14 +6785,14 @@ sys/src/cmd/acid/print.c - 664 sys sys 984756705 6840
 sys/src/cmd/acid/proc.c - 664 sys sys 1014924908 4513
 sys/src/cmd/acid/util.c - 664 sys sys 944960738 4297
 sys/src/cmd/acme - 20000000775 sys sys 969511023 0
-sys/src/cmd/acme/acme.c - 664 sys sys 1097972699 19493
+sys/src/cmd/acme/acme.c - 664 sys sys 1101910760 19489
 sys/src/cmd/acme/addr.c - 664 sys sys 1018553456 4787
 sys/src/cmd/acme/buff.c - 664 sys sys 1014926092 5573
 sys/src/cmd/acme/cols.c - 664 sys sys 1079102914 11126
-sys/src/cmd/acme/dat.h - 664 sys sys 1097972700 11144
+sys/src/cmd/acme/dat.h - 664 sys sys 1101910760 11143
 sys/src/cmd/acme/disk.c - 664 sys sys 1014926093 2151
 sys/src/cmd/acme/ecmd.c - 664 sys sys 1077376256 24294
-sys/src/cmd/acme/edit.c - 664 sys sys 1015701171 12055
+sys/src/cmd/acme/edit.c - 664 sys sys 1101910761 12068
 sys/src/cmd/acme/edit.h - 664 sys sys 969500816 2466
 sys/src/cmd/acme/elog.c - 664 sys sys 1078839859 7236
 sys/src/cmd/acme/exec.c - 664 sys sys 1099329953 28183
@@ -6802,7 +6802,7 @@ sys/src/cmd/acme/fsys.c - 664 sys sys 1079102915 12799
 sys/src/cmd/acme/look.c - 664 sys sys 1077376257 14213
 sys/src/cmd/acme/mkfile - 664 sys sys 1058463682 543
 sys/src/cmd/acme/regx.c - 664 sys sys 1014926094 16057
-sys/src/cmd/acme/rows.c - 664 sys sys 1084542482 14664
+sys/src/cmd/acme/rows.c - 664 sys sys 1101910761 14683
 sys/src/cmd/acme/scrl.c - 664 sys sys 1014926095 3072
 sys/src/cmd/acme/text.c - 664 sys sys 1099500744 27642
 sys/src/cmd/acme/time.c - 664 sys sys 1014926095 1783
@@ -7531,7 +7531,7 @@ sys/src/cmd/fax/receive.c - 664 sys sys 944960990 1097
 sys/src/cmd/fax/receiverc - 775 sys sys 944960990 581
 sys/src/cmd/fax/send.c - 664 sys sys 944960990 923
 sys/src/cmd/fax/subr.c - 664 sys sys 1015090401 1245
-sys/src/cmd/file.c - 664 sys sys 1084471672 21379
+sys/src/cmd/file.c - 664 sys sys 1101909618 22781
 sys/src/cmd/fmt.c - 664 sys sys 1070032009 4088
 sys/src/cmd/fortune.c - 664 sys sys 1072729222 1779
 sys/src/cmd/fossil - 20000000775 sys sys 1042005512 0
@@ -10435,7 +10435,7 @@ sys/src/cmd/tapefs/v10fs.c - 664 sys sys 1014926385 3754
 sys/src/cmd/tapefs/v6fs.c - 664 sys sys 1014926385 3971
 sys/src/cmd/tapefs/zip.h - 664 sys sys 1097914153 1428
 sys/src/cmd/tapefs/zipfs.c - 664 sys sys 1097900277 6803
-sys/src/cmd/tar.c - 664 sys sys 1094598836 15585
+sys/src/cmd/tar.c - 664 sys sys 1101909630 15630
 sys/src/cmd/tbl - 20000000775 sys sys 954038038 0
 sys/src/cmd/tbl/mkfile - 664 sys sys 944961243 268
 sys/src/cmd/tbl/t.h - 664 sys sys 944961244 3987
@@ -10936,11 +10936,11 @@ sys/src/cmd/usb/audio/audiosub.c - 664 sys sys 1100568596 6967
 sys/src/cmd/usb/audio/mkfile - 664 sys sys 1091204980 349
 sys/src/cmd/usb/audio/usbaudio.c - 664 sys sys 1100619443 9818
 sys/src/cmd/usb/audio/usbaudio.h - 664 sys sys 1100568597 1861
-sys/src/cmd/usb/audio/usbaudioctl.c - 664 sys sys 1100568597 17264
+sys/src/cmd/usb/audio/usbaudioctl.c - 664 sys sys 1101906325 17266
 sys/src/cmd/usb/audio/usbaudioctl.h - 664 sys sys 1100568597 600
 sys/src/cmd/usb/lib - 20000000775 sys sys 1018369393 0
 sys/src/cmd/usb/lib/device.c - 664 sys sys 1099760882 2968
-sys/src/cmd/usb/lib/dump.c - 664 sys sys 1099760882 12704
+sys/src/cmd/usb/lib/dump.c - 664 sys sys 1101906317 12757
 sys/src/cmd/usb/lib/fmt.c - 664 sys sys 1091204978 291
 sys/src/cmd/usb/lib/mkfile - 664 sys sys 1091204979 204
 sys/src/cmd/usb/lib/setup.c - 664 sys sys 1091204978 1953
@@ -11904,7 +11904,7 @@ sys/src/libflate/zlib.h - 664 sys sys 984709217 219
 sys/src/libframe - 20000000775 sys sys 944961726 0
 sys/src/libframe/frbox.c - 664 sys sys 1078466650 3028
 sys/src/libframe/frdelete.c - 664 sys sys 944961726 3079
-sys/src/libframe/frdraw.c - 664 sys sys 945275945 3277
+sys/src/libframe/frdraw.c - 664 sys sys 1101910634 3271
 sys/src/libframe/frinit.c - 664 sys sys 1019498851 1761
 sys/src/libframe/frinsert.c - 664 sys sys 984709939 6700
 sys/src/libframe/frptofchar.c - 664 sys sys 944961726 1995

+ 17 - 0
dist/replica/plan9.log

@@ -17128,3 +17128,20 @@
 1101830425 0 c sys/games/lib/fortunes - 664 sys sys 1101830177 251359
 1101832226 0 c sys/man/4/usb - 664 sys sys 1101830658 3423
 1101832226 1 c sys/src/cmd/usb/misc/usbprint - 775 sys sys 1101830683 256
+1101907840 0 c sys/src/9/ip/ip.c - 664 sys sys 1101906449 15285
+1101907840 1 c sys/src/cmd/usb/audio/usbaudioctl.c - 664 sys sys 1101906325 17266
+1101907840 2 c sys/src/cmd/usb/lib/dump.c - 664 sys sys 1101906317 12757
+1101909640 0 c sys/src/cmd/file.c - 664 sys sys 1101909618 22781
+1101909640 1 c sys/src/cmd/tar.c - 664 sys sys 1101909630 15630
+1101911441 0 c sys/src/cmd/acme/acme.c - 664 sys sys 1101910760 19489
+1101911441 1 c sys/src/cmd/acme/dat.h - 664 sys sys 1101910760 11143
+1101911441 2 c sys/src/cmd/acme/edit.c - 664 sys sys 1101910761 12068
+1101911441 3 c sys/src/cmd/acme/rows.c - 664 sys sys 1101910761 14683
+1101911441 4 c sys/src/libframe/frdraw.c - 664 sys sys 1101910634 3271
+1101961850 0 c 386/bin/acme - 775 sys sys 1101960674 425079
+1101961850 1 c 386/bin/usb/usbaudio - 775 sys sys 1101960675 183323
+1101961850 2 c 386/bin/usb/usbd - 775 sys sys 1101960675 127706
+1101961850 3 c 386/bin/file - 775 sys sys 1101960674 110319
+1101961850 4 c 386/bin/aux/samterm - 775 sys sys 1101960674 245747
+1101961850 5 c 386/bin/tar - 775 sys sys 1101960675 81834
+1101961850 6 c 386/lib/libframe.a - 664 sys sys 1101960676 66060

+ 4 - 6
sys/src/9/ip/ip.c

@@ -8,10 +8,10 @@
 #include	"ip.h"
 
 typedef struct Ip4hdr		Ip4hdr;
-typedef struct	IP	IP;
-typedef struct	Fragment4	Fragment4;
-typedef struct	Fragment6	Fragment6;
-typedef struct	Ipfrag	Ipfrag;
+typedef struct IP		IP;
+typedef struct Fragment4	Fragment4;
+typedef struct Fragment6	Fragment6;
+typedef struct Ipfrag		Ipfrag;
 
 enum
 {
@@ -803,5 +803,3 @@ ipcsum(uchar *addr)
 
 	return (sum^0xffff);
 }
-
-

+ 1 - 3
sys/src/cmd/acme/acme.c

@@ -184,9 +184,7 @@ threadmain(int argc, char *argv[])
 
 	#define	WPERCOL	8
 	disk = diskinit();
-	if(loadfile)
-		rowload(&row, loadfile, TRUE);
-	else{
+	if(!loadfile || !rowload(&row, loadfile, TRUE)){
 		rowinit(&row, screen->clipr);
 		if(ncol < 0){
 			if(argc == 0)

+ 1 - 1
sys/src/cmd/acme/dat.h

@@ -327,7 +327,7 @@ Text*	rowtype(Row*, Rune, Point);
 void		rowdragcol(Row*, Column*, int but);
 int		rowclean(Row*);
 void		rowdump(Row*, char*);
-void		rowload(Row*, char*, int);
+int		rowload(Row*, char*, int);
 void		rowloadfonts(char*);
 
 struct Timer

+ 1 - 0
sys/src/cmd/acme/edit.c

@@ -440,6 +440,7 @@ collecttext(void)
 				goto Return;
 		}while(s->r[begline]!='.' || s->r[begline+1]!='\n');
 		s->r[s->n-2] = '\0';
+		s->n -= 2;
 	}else{
 		okdelim(delim = getch());
 		getrhs(s, delim, 'a');

+ 5 - 5
sys/src/cmd/acme/rows.c

@@ -472,7 +472,7 @@ rowloadfonts(char *file)
 	Bterm(b);
 }
 
-void
+int
 rowload(Row *row, char *file, int initing)
 {
 	int i, j, line, percent, y, nr, nfontr, n, ns, ndumped, dumpid, x, fd;
@@ -697,15 +697,15 @@ rowload(Row *row, char *file, int initing)
 		w->maxlines = min(w->body.nlines, max(w->maxlines, w->body.maxlines));
 	}
 	Bterm(b);
-
-Rescue1:
 	fbuffree(buf);
-	return;
+	return TRUE;
 
 Rescue2:
 	warning(nil, "bad load file %s:%d\n", file, line);
 	Bterm(b);
-	goto Rescue1;
+Rescue1:
+	fbuffree(buf);
+	return FALSE;
 }
 
 void

+ 68 - 0
sys/src/cmd/file.c

@@ -160,6 +160,7 @@ int	ismsdos(void);
 int	iself(void);
 int	istring(void);
 int	long0(void);
+int	istar(void);
 int	p9bitnum(uchar*);
 int	p9subfont(uchar*);
 void	print_utf(void);
@@ -173,6 +174,7 @@ int	(*call[])(void) =
 	istring,	/* recognizable by first string */
 	isrfc822,	/* email file */
 	ismbox,		/* mail box */
+	istar,		/* recognizable by tar checksum */
 	ishtml,		/* html keywords */
 	iscint,		/* compiler/assembler intermediate */
 	islimbo,	/* limbo source */
@@ -551,6 +553,72 @@ long0(void)
 	return 0;
 }
 
+/* from tar.c */
+enum { NAMSIZ = 100, TBLOCK = 512 };
+
+union	hblock
+{
+	char	dummy[TBLOCK];
+	struct	header
+	{
+		char	name[NAMSIZ];
+		char	mode[8];
+		char	uid[8];
+		char	gid[8];
+		char	size[12];
+		char	mtime[12];
+		char	chksum[8];
+		char	linkflag;
+		char	linkname[NAMSIZ];
+		/* rest are defined by POSIX's ustar format; see p1003.2b */
+		char	magic[6];	/* "ustar" */
+		char	version[2];
+		char	uname[32];
+		char	gname[32];
+		char	devmajor[8];
+		char	devminor[8];
+		char	prefix[155];  /* if non-null, path = prefix "/" name */
+	} dbuf;
+};
+
+int
+checksum(union hblock *hp)
+{
+	int i;
+	char *cp;
+	struct header *hdr = &hp->dbuf;
+
+	for (cp = hdr->chksum; cp < &hdr->chksum[sizeof hdr->chksum]; cp++)
+		*cp = ' ';
+	i = 0;
+	for (cp = hp->dummy; cp < &hp->dummy[TBLOCK]; cp++)
+		i += *cp & 0xff;
+	return i;
+}
+
+int
+istar(void)
+{
+	int chksum;
+	char tblock[TBLOCK];
+	union hblock *hp = (union hblock *)tblock;
+	struct header *hdr = &hp->dbuf;
+
+	seek(fd, 0, 0);		/* reposition to start of file */
+	if (readn(fd, tblock, sizeof tblock) != sizeof tblock)
+		return 0;
+	chksum = strtol(hdr->chksum, 0, 8);
+	if (hdr->name[0] != '\0' && checksum(hp) == chksum) {
+		if (strcmp(hdr->magic, "ustar") == 0)
+			print(mime? "application/x-ustar\n":
+				"posix tar archive\n");
+		else
+			print(mime? "application/x-tar\n": "tar archive\n");
+		return 1;
+	}
+	return 0;
+}
+
 /*
  * initial words to classify file
  */

+ 13 - 6
sys/src/cmd/tar.c

@@ -126,7 +126,7 @@ getfullname(struct header *hp)
 	if (fullname != nil)
 		free(fullname);
 	namlen = strnlen(hp->name, sizeof hp->name);
-	if (hp->prefix[0] == '\0' || !ustar) {
+	if (hp->prefix[0] == '\0' || !ustar) {	/* old-style name? */
 		fullname = malloc(namlen + 1);
 		if (fullname == nil)
 			sysfatal("out of memory: %r");
@@ -368,10 +368,16 @@ dorep(char **argv)
 	flushtar();
 }
 
+int
+isendtar(void)
+{
+	return fullname[0] == '\0';
+}
+
 int
 endtar(void)
 {
-	if (dblock.dbuf.name[0] == '\0') {
+	if (isendtar()) {
 		backtar();
 		return(1);
 	}
@@ -385,7 +391,9 @@ getdir(void)
 	Dir *sp;
 
 	readtar((char*)&dblock);
-	if (dblock.dbuf.name[0] == '\0')
+	ustar = isustar(&dblock.dbuf);
+	getfullname(&dblock.dbuf);
+	if (isendtar())
 		return;
 	if(stbuf == nil){
 		stbuf = malloc(sizeof(Dir));
@@ -402,8 +410,6 @@ getdir(void)
 	if (chksum != checksum())
 		sysfatal("header checksum error");
 	sp->qid.type = 0;
-	ustar = isustar(&dblock.dbuf);
-	getfullname(&dblock.dbuf);
 	/* the mode test is ugly but sometimes necessary */
 	if (dblock.dbuf.linkflag == LF_DIR || (sp->mode&0170000) == 040000 ||
 	    strrchr(fullname, '\0')[-1] == '/') {
@@ -463,7 +469,8 @@ putfile(char *dir, char *longname, char *sname)
 
 	if (stbuf->qid.type & QTDIR) {
 		/* Directory */
-		for (i = 0, cp = buf; *cp++ = longname[i++];);
+		for (i = 0, cp = buf; *cp++ = longname[i++];)
+			;
 		*--cp = '/';
 		*++cp = 0;
 		stbuf->length = 0;

+ 1 - 1
sys/src/cmd/usb/audio/usbaudioctl.c

@@ -218,7 +218,7 @@ setspeed(int rec, int speed)
 		* controls[rec][Channel_control].value[0]
 		* controls[rec][Resolution_control].value[0]/8;
 	if(ps > ep->maxpkt){
-		fprint(2, "packet size %d > maximum packet size %d",
+		fprint(2, "packet size %d > maximum packet size %d\n",
 			ps, ep->maxpkt);
 		return Undef;
 	}

+ 2 - 1
sys/src/cmd/usb/lib/dump.c

@@ -495,7 +495,8 @@ pdesc(Device *d, int c, ulong csp, byte *b, int n)
 			ep = de->bEndpointAddress & 0xf;
 			if (d->ep[ep] == nil)
 				d->ep[ep] = newendpt(d, ep, class);
-			d->ep[ep]->maxpkt = GET2(de->wMaxPacketSize);
+			if(d->ep[ep]->maxpkt < GET2(de->wMaxPacketSize))
+				d->ep[ep]->maxpkt = GET2(de->wMaxPacketSize);
 			d->ep[ep]->addr = de->bEndpointAddress;
 			d->ep[ep]->csp = csp;
 			d->ep[ep]->conf = d->config[c];

+ 1 - 1
sys/src/libframe/frdraw.c

@@ -149,7 +149,7 @@ _frdraw(Frame *f, Point pt)
 		if(b->nrune > 0){
 			n = _frcanfit(f, pt, b);
 			if(n == 0)
-				drawerror(f->display, "draw: _frcanfit==0");
+				drawerror(f->display, "_frcanfit==0");
 			if(n != b->nrune){
 				_frsplitbox(f, nb, n);
 				b = &f->box[nb];