Browse Source

Fix more warnings.

Fix a bunch more warnings in cmd.

Signed-off-by: Dan Cross <cross@gajendra.net>
Dan Cross 7 years ago
parent
commit
bb7baac699

+ 2 - 2
sys/src/cmd/9660srv/main.c

@@ -549,10 +549,10 @@ showdir(int fd, Dir *s)
 	char *p;
 
 	strcpy(a_time, ctime(s->atime));
-	if(p=strchr(a_time, '\n'))	/* assign = */
+	if((p=strchr(a_time, '\n')) != nil)	/* assign = */
 		*p = 0;
 	strcpy(m_time, ctime(s->mtime));
-	if(p=strchr(m_time, '\n'))	/* assign = */
+	if((p=strchr(m_time, '\n')) != nil)	/* assign = */
 		*p = 0;
 	fprint(fd, "name=\"%s\" qid=(0x%llux,%lu) type=%d dev=%d \
 mode=0x%8.8lux=0%luo atime=%s mtime=%s length=%lld uid=\"%s\" gid=\"%s\"...",

+ 1 - 1
sys/src/cmd/9660srv/xfile.c

@@ -145,7 +145,7 @@ xfile(int fid, int flag)
 	}
 	if(f)
 		return clean(f);
-	if(f = freelist)	/* assign = */
+	if((f = freelist) != nil)	/* assign = */
 		freelist = f->next;
 	else
 		f = ealloc(sizeof(Xfile));

+ 5 - 5
sys/src/cmd/ar.c

@@ -331,7 +331,7 @@ dcmd(char *arname, int count, char **files)
 	Binit(&bar, fd, OREAD);
 	Bseek(&bar,seek(fd,0,1), 1);
 	astart = newtempfile(artemp);
-	for (i = 0; bp = getdir(&bar); i++) {
+	for (i = 0; (bp = getdir(&bar)) != nil; i++) {
 		if(match(count, files)) {
 			mesg('d', file);
 			skip(&bar, bp->size);
@@ -359,7 +359,7 @@ xcmd(char *arname, int count, char **files)
 	Binit(&bar, fd, OREAD);
 	Bseek(&bar,seek(fd,0,1), 1);
 	i = 0;
-	while (bp = getdir(&bar)) {
+	while ((bp = getdir(&bar)) != nil) {
 		if(count == 0 || match(count, files)) {
 			mode = strtoul(bp->hdr.mode, 0, 8) & 0777;
 			f = create(file, OWRITE, mode);
@@ -400,7 +400,7 @@ pcmd(char *arname, int count, char **files)
 	fd = openar(arname, OREAD, 0);
 	Binit(&bar, fd, OREAD);
 	Bseek(&bar,seek(fd,0,1), 1);
-	while(bp = getdir(&bar)) {
+	while((bp = getdir(&bar)) != nil){
 		if(count == 0 || match(count, files)) {
 			if(vflag)
 				print("\n<%s>\n\n", file);
@@ -429,7 +429,7 @@ mcmd(char *arname, int count, char **files)
 	amiddle = newtempfile(movtemp);
 	aend = 0;
 	ap = astart;
-	for (i = 0; bp = getdir(&bar); i++) {
+	for (i = 0; (bp = getdir(&bar)) != nil; i++) {
 		if (bamatch(file, poname)) {
 			aend = newtempfile(tailtemp);
 			ap = aend;
@@ -466,7 +466,7 @@ tcmd(char *arname, int count, char **files)
 	fd = openar(arname, OREAD, 0);
 	Binit(&bar, fd, OREAD);
 	Bseek(&bar,seek(fd,0,1), 1);
-	while(bp = getdir(&bar)) {
+	while((bp = getdir(&bar)) != nil){
 		if(count == 0 || match(count, files)) {
 			if(vflag)
 				int32_tt(bp);

+ 2 - 2
sys/src/cmd/archfs.c

@@ -61,7 +61,7 @@ Bgetline(Biobuf *b)
 {
 	char *p;
 
-	if(p = Brdline(b, '\n'))
+	if((p = Brdline(b, '\n')) != nil)
 		p[Blinelen(b)-1] = '\0';
 	return p;
 }
@@ -236,7 +236,7 @@ main(int argc, char **argv)
 		sysfatal("open '%s': %r", argv[0]);
 
 	archtree = fs.tree = alloctree("sys", "sys", DMDIR|0775, nil);
-	while(a = gethdr(b)) {
+	while((a = gethdr(b)) != nil){
 		archcreatefile(a->_name, newarch(Boffset(b), a->Dir.length), &a->Dir);
 		Bseek(b, a->Dir.length, 1);
 	}

+ 1 - 1
sys/src/cmd/calendar.c

@@ -100,7 +100,7 @@ main(int argc, char *argv[])
 		}
 
 		/* go through the file */
-		while(line = Brdline(&in, '\n')){
+		while((line = Brdline(&in, '\n')) != nil){
 			line[Blinelen(&in) - 1] = 0;
 			upper2lower(buf, line, sizeof buf);
 			for(d=Base; d; d=d->next)

+ 2 - 2
sys/src/cmd/calls.c

@@ -28,7 +28,7 @@
 #define STREQ(a, b)	(*(a) == *(b) && strcmp(a, b) == 0)
 #define OTHER(rdwr)	((rdwr) == Rd? Wr: Rd)
 /* per 8c, all multibyte runes are considered alphabetic */
-#define ISIDENT(r) (isascii(r) && isalnum(r) || (r) == '_' || (r) >= Runeself)
+#define ISIDENT(r) ((isascii(r) && isalnum(r)) || (r) == '_' || (r) >= Runeself)
 
 /* safe macros */
 #define checksys(atom)		strbsearch(atom, sysword, nelem(sysword))
@@ -499,7 +499,7 @@ skipcomments(Biobuf *in, int firstc)
 {
 	int c;
 
-	for (c = firstc; isascii(c) && isspace(c) || c == '/'; c = nextc(in)) {
+	for (c = firstc; (isascii(c) && isspace(c)) || c == '/'; c = nextc(in)) {
 		if (c == '\n')
 			lineno++;
 		if (c != '/')

+ 1 - 1
sys/src/cmd/dc.c

@@ -1979,7 +1979,7 @@ cond(char c)
 	cc = sbackc(p);
 	release(p);
 	if((cc<0 && (c == '<' || c == NG)) ||
-	   (cc >0) && (c == '>' || c == NL)) {
+	   ((cc >0) && (c == '>' || c == NL))) {
 		getstk();
 		return(0);
 	}

+ 3 - 3
sys/src/cmd/deroff.c

@@ -169,7 +169,7 @@ main(int argc, char *av[])
 		break;
 	case 'm':
 		msflag = YES;
-		if(f = ARGF())
+		if((f = ARGF()) != nil)
 			switch(*f)
 			{
 			case 'm':	mac = MM; break;
@@ -498,7 +498,7 @@ comx:
 		else {
 			getfname();
 			if(fname[0]) {
-				if(infile = opn(fname))
+				if((infile = opn(fname)) != nil)
 					*++filesp = infile;
 				else infile = *filesp;
 			}
@@ -846,7 +846,7 @@ copys(char *s)
 
 	if((t0 = t = malloc((strlen(s)+1))) == 0)
 		fatal("Cannot allocate memory", (char*)0);
-	while(*t++ = *s++)
+	while((*t++ = *s++) != '\0')
 		;
 	return(t0);
 }

+ 2 - 1
sys/src/cmd/du.c

@@ -149,11 +149,12 @@ main(int argc, char *argv[])
 		usage();
 	} ARGEND
 
-	if (unit == 0)
+	if (unit == 0) {
 		if (qflag || tflag || uflag || autoscale)
 			unit = 1;
 		else
 			unit = Vkilo;
+	}
 	if (blocksize < 1)
 		blocksize = 1;
 

+ 2 - 2
sys/src/cmd/ecp.c

@@ -49,7 +49,7 @@ enum {
 /* disk address (in bytes or sectors), also type of 2nd arg. to seek */
 typedef uint64_t Daddr;
 typedef int64_t Sdaddr;				/* signed disk address */
-typedef int32_t Rdwrfn(int, void *, int32_t);		/* plan 9 read or write */
+typedef int32_t Rdwrfn(int, void *, int32_t);	/* plan 9 read or write */
 
 typedef struct {
 	char	*name;
@@ -483,7 +483,7 @@ copysects(File *src, File *dest, Daddr stsect, Daddr nsects, int mustseek)
 	bigxfer(src,  read,  buf, stsect, xfrsects, mustseek);
 	if (swizzle)
 		swizzlebits(buf, xfrsects);
-	bigxfer(dest, write, buf, stsect, xfrsects, mustseek);
+	bigxfer(dest, (Rdwrfn *)write, buf, stsect, xfrsects, mustseek);
 	/* give a few reassurances at the start, then every 10MB */
 	if (progress &&
 	    (stsect < blksects*10 || stsect%(10*1024*1024/sectsz) == 0))

+ 18 - 16
sys/src/cmd/ed.c

@@ -156,14 +156,14 @@ main(int argc, char *argv[])
 	if(oflag) {
 		p1 = "/fd/1";
 		p2 = savedfile;
-		while(*p2++ = *p1++)
+		while((*p2++ = *p1++) != 0)
 			;
 		globp = &la;
 	} else
 	if(*argv) {
 		p1 = *argv;
 		p2 = savedfile;
-		while(*p2++ = *p1++)
+		while((*p2++ = *p1++) != 0)
 			if(p2 >= &savedfile[sizeof(savedfile)])
 				p2--;
 		globp = &lr;
@@ -594,7 +594,7 @@ filename(int comm)
 		if(*p1 == 0 && comm != 'f')
 			error(Q);
 		p2 = file;
-		while(*p2++ = *p1++)
+		while((*p2++ = *p1++) != 0)
 			;
 		return;
 	}
@@ -615,7 +615,7 @@ filename(int comm)
 	if(savedfile[0] == 0 || comm == 'e' || comm == 'f') {
 		p1 = savedfile;
 		p2 = file;
-		while(*p1++ = *p2++)
+		while((*p1++ = *p2++) != 0)
 			;
 	}
 }
@@ -711,7 +711,7 @@ notifyf(void *a, char *s)
 int
 getchr(void)
 {
-	if(lastc = peekc) {
+	if((lastc = peekc) != 0) {
 		peekc = 0;
 		return lastc;
 	}
@@ -1001,7 +1001,7 @@ getline(int tl)
 	bp = getblock(tl, OREAD);
 	nl = nleft;
 	tl &= ~((BLKSIZE/sizeof(Rune)) - 1);
-	while(*lp++ = *bp++) {
+	while((*lp++ = *bp++) != 0){
 		nl -= sizeof(Rune);
 		if(nl == 0) {
 			tl += BLKSIZE/sizeof(Rune);
@@ -1024,7 +1024,7 @@ putline(void)
 	bp = getblock(tl, OWRITE);
 	nl = nleft;
 	tl &= ~((BLKSIZE/sizeof(Rune))-1);
-	while(*bp = *lp++) {
+	while((*bp = *lp++) != 0){
 		if(*bp++ == '\n') {
 			bp[-1] = 0;
 			linebp = lp;
@@ -1042,8 +1042,10 @@ putline(void)
 	return nl;
 }
 
+typedef int32_t Rdwrfn(int, void *, int32_t);
+
 void
-blkio(int b, uint8_t *buf, int32_t (*iofcn)(int, void *, int32_t))
+blkio(int b, uint8_t *buf, Rdwrfn *iofcn)
 {
 	seek(tfile, b*BLKSIZE, 0);
 	if((*iofcn)(tfile, buf, BLKSIZE) != BLKSIZE) {
@@ -1075,14 +1077,14 @@ getblock(int atl, int iof)
 		return (Rune*)(obuff+off);
 	if(iof == OREAD) {
 		if(ichanged)
-			blkio(iblock, ibuff, write);
+			blkio(iblock, ibuff, (Rdwrfn *)write);
 		ichanged = 0;
 		iblock = bno;
 		blkio(bno, ibuff, read);
 		return (Rune*)(ibuff+off);
 	}
 	if(oblock >= 0)
-		blkio(oblock, obuff, write);
+		blkio(oblock, obuff, (Rdwrfn *)write);
 	oblock = bno;
 	return (Rune*)(obuff+off);
 }
@@ -1173,13 +1175,13 @@ join(void)
 	gp = genbuf;
 	for(a1=addr1; a1<=addr2; a1++) {
 		lp = getline(*a1);
-		while(*gp = *lp++)
+		while((*gp = *lp++) != 0)
 			if(gp++ >= &genbuf[LBSIZE-sizeof(Rune)])
 				error(Q);
 	}
 	lp = linebuf;
 	gp = genbuf;
-	while(*lp++ = *gp++)
+	while((*lp++ = *gp++) != 0)
 		;
 	*addr1 = putline();
 	if(addr1 < addr2)
@@ -1285,7 +1287,7 @@ getsub(void)
 	p1 = linebuf;
 	if((p2 = linebp) == 0)
 		return EOF;
-	while(*p1++ = *p2++)
+	while((*p1++ = *p2++) != 0)
 		;
 	linebp = 0;
 	return 0;
@@ -1302,7 +1304,7 @@ dosub(void)
 	rp = rhsbuf;
 	while(lp < loc1)
 		*sp++ = *lp++;
-	while(c = *rp++) {
+	while((c = *rp++) != 0){
 		if(c == '&'){
 			sp = place(sp, loc1, loc2);
 			continue;
@@ -1321,12 +1323,12 @@ dosub(void)
 	}
 	lp = loc2;
 	loc2 = sp - genbuf + linebuf;
-	while(*sp++ = *lp++)
+	while((*sp++ = *lp++) != 0)
 		if(sp >= &genbuf[LBSIZE])
 			error(Q);
 	lp = linebuf;
 	sp = genbuf;
-	while(*lp++ = *sp++)
+	while((*lp++ = *sp++) != 0)
 		;
 }
 

+ 1 - 1
sys/src/cmd/fcp.c

@@ -208,7 +208,7 @@ worker(int fdf, int fdt, char *from, char *to)
 	bp = buf;
 	o = nextoff();
 
-	while(n = pread(fdf, bp, len, o)){
+	while((n = pread(fdf, bp, len, o)) != 0){
 		if(n < 0){
 			fprint(2, "reading %s at %lld: %r\n", from, o);
 			_exits("bad");

+ 152 - 152
sys/src/cmd/file.c

@@ -49,45 +49,45 @@ struct
 	int	class;
 } dict[] =
 {
-	"PATH",		Lword,
-	"TEXT",		Aword,
-	"adt",		Alword,
-	"aggr",		Alword,
-	"alef",		Alword,
-	"array",	Lword,
-	"block",	Fword,
-	"char",		Cword,
-	"common",	Fword,
-	"con",		Lword,
-	"data",		Fword,
-	"dimension",	Fword,
-	"double",	Cword,
-	"extern",	Cword,
-	"bio",		I2,
-	"float",	Cword,
-	"fn",		Lword,
-	"function",	Fword,
-	"h",		I3,
-	"implement",	Lword,
-	"import",	Lword,
-	"include",	I1,
-	"int",		Cword,
-	"integer",	Fword,
-	"iota",		Lword,
-	"libc",		I2,
-	"int32_t",		Cword,
-	"module",	Lword,
-	"real",		Fword,
-	"ref",		Lword,
-	"register",	Cword,
-	"self",		Lword,
-	"short",	Cword,
-	"static",	Cword,
-	"stdio",	I2,
-	"struct",	Cword,
-	"subroutine",	Fword,
-	"u",		I2,
-	"void",		Cword,
+	{"PATH",	Lword},
+	{"TEXT",	Aword},
+	{"adt",		Alword},
+	{"aggr",	Alword},
+	{"alef",	Alword},
+	{"array",	Lword},
+	{"block",	Fword},
+	{"char",	Cword},
+	{"common",	Fword},
+	{"con",		Lword},
+	{"data",	Fword},
+	{"dimension",	Fword},
+	{"double",	Cword},
+	{"extern",	Cword},
+	{"bio",		I2},
+	{"float",	Cword},
+	{"fn",		Lword},
+	{"function",	Fword},
+	{"h",		I3},
+	{"implement",	Lword},
+	{"import",	Lword},
+	{"include",	I1},
+	{"int",		Cword},
+	{"integer",	Fword},
+	{"iota",	Lword},
+	{"libc",	I2},
+	{"int32_t",	Cword},
+	{"module",	Lword},
+	{"real",	Fword},
+	{"ref",		Lword},
+	{"register",	Cword},
+	{"self",	Lword},
+	{"short",	Cword},
+	{"static",	Cword},
+	{"stdio",	I2},
+	{"struct",	Cword},
+	{"subroutine",	Fword},
+	{"u",		I2},
+	{"void",	Cword},
 };
 
 /* codes for 'mode' field in language structure */
@@ -108,31 +108,31 @@ struct
 
 } language[] =
 {
-	Normal,	0,	0x0100,	0x01FF,	"Extended Latin",
-	Normal,	0,	0x0370,	0x03FF,	"Greek",
-	Normal,	0,	0x0400,	0x04FF,	"Cyrillic",
-	Normal,	0,	0x0530,	0x058F,	"Armenian",
-	Normal,	0,	0x0590,	0x05FF,	"Hebrew",
-	Normal,	0,	0x0600,	0x06FF,	"Arabic",
-	Normal,	0,	0x0900,	0x097F,	"Devanagari",
-	Normal,	0,	0x0980,	0x09FF,	"Bengali",
-	Normal,	0,	0x0A00,	0x0A7F,	"Gurmukhi",
-	Normal,	0,	0x0A80,	0x0AFF,	"Gujarati",
-	Normal,	0,	0x0B00,	0x0B7F,	"Oriya",
-	Normal,	0,	0x0B80,	0x0BFF,	"Tamil",
-	Normal,	0,	0x0C00,	0x0C7F,	"Telugu",
-	Normal,	0,	0x0C80,	0x0CFF,	"Kannada",
-	Normal,	0,	0x0D00,	0x0D7F,	"Malayalam",
-	Normal,	0,	0x0E00,	0x0E7F,	"Thai",
-	Normal,	0,	0x0E80,	0x0EFF,	"Lao",
-	Normal,	0,	0x1000,	0x105F,	"Tibetan",
-	Normal,	0,	0x10A0,	0x10FF,	"Georgian",
-	Normal,	0,	0x3040,	0x30FF,	"Japanese",
-	Normal,	0,	0x3100,	0x312F,	"Chinese",
-	First,	0,	0x3130,	0x318F,	"Korean",
-	Multi,	0,	0x3400,	0x3D2F,	"Korean",
-	Shared,	0,	0x4e00,	0x9fff,	"CJK",
-	Normal,	0,	0,	0,	0,		/* terminal entry */
+	{Normal,	0,	0x0100,	0x01FF,	"Extended Latin"},
+	{Normal,	0,	0x0370,	0x03FF,	"Greek"},
+	{Normal,	0,	0x0400,	0x04FF,	"Cyrillic"},
+	{Normal,	0,	0x0530,	0x058F,	"Armenian"},
+	{Normal,	0,	0x0590,	0x05FF,	"Hebrew"},
+	{Normal,	0,	0x0600,	0x06FF,	"Arabic"},
+	{Normal,	0,	0x0900,	0x097F,	"Devanagari"},
+	{Normal,	0,	0x0980,	0x09FF,	"Bengali"},
+	{Normal,	0,	0x0A00,	0x0A7F,	"Gurmukhi"},
+	{Normal,	0,	0x0A80,	0x0AFF,	"Gujarati"},
+	{Normal,	0,	0x0B00,	0x0B7F,	"Oriya"},
+	{Normal,	0,	0x0B80,	0x0BFF,	"Tamil"},
+	{Normal,	0,	0x0C00,	0x0C7F,	"Telugu"},
+	{Normal,	0,	0x0C80,	0x0CFF,	"Kannada"},
+	{Normal,	0,	0x0D00,	0x0D7F,	"Malayalam"},
+	{Normal,	0,	0x0E00,	0x0E7F,	"Thai"},
+	{Normal,	0,	0x0E80,	0x0EFF,	"Lao"},
+	{Normal,	0,	0x1000,	0x105F,	"Tibetan"},
+	{Normal,	0,	0x10A0,	0x10FF,	"Georgian"},
+	{Normal,	0,	0x3040,	0x30FF,	"Japanese"},
+	{Normal,	0,	0x3100,	0x312F,	"Chinese"},
+	{First,		0,	0x3130,	0x318F,	"Korean"},
+	{Multi,		0,	0x3400,	0x3D2F,	"Korean"},
+	{Shared,	0,	0x4e00,	0x9fff,	"CJK"},
+	{Normal,	0,	0,	0,	0},		/* terminal entry */
 };
 
 
@@ -535,39 +535,39 @@ struct Filemagic {
  * when read from a file.
  */
 Filemagic long0tab[] = {
-	0xF16DF16D,	0xFFFFFFFF,	"pac1 audio file\n",	OCTET,
+	{0xF16DF16D,	0xFFFFFFFF,	"pac1 audio file\n",	OCTET},
 	/* "pac1" */
-	0x31636170,	0xFFFFFFFF,	"pac3 audio file\n",	OCTET,
+	{0x31636170,	0xFFFFFFFF,	"pac3 audio file\n",	OCTET},
 	/* "pXc2 */
-	0x32630070,	0xFFFF00FF,	"pac4 audio file\n",	OCTET,
-	0xBA010000,	0xFFFFFFFF,	"mpeg system stream\n",	OCTET,
-	0x43614c66,	0xFFFFFFFF,	"FLAC audio file\n",	OCTET,
-	0x30800CC0,	0xFFFFFFFF,	"inferno .dis executable\n", OCTET,
-	0x04034B50,	0xFFFFFFFF,	"zip archive\n", "application/zip",
-	070707,		0xFFFF,		"cpio archive\n", OCTET,
-	0x2F7,		0xFFFF,		"tex dvi\n", "application/dvi",
-	0xfaff,		0xfeff,		"mp3 audio\n",	"audio/mpeg",
-	0xf0ff,		0xf6ff,		"aac audio\n",	"audio/mpeg",
-	0xfeff0000,	0xffffffff,	"utf-32be\n",	"text/plain charset=utf-32be",
-	0xfffe,		0xffffffff,	"utf-32le\n",	"text/plain charset=utf-32le",
-	0xfeff,		0xffff,		"utf-16be\n",	"text/plain charset=utf-16be",
-	0xfffe,		0xffff,		"utf-16le\n",	"text/plain charset=utf-16le",
+	{0x32630070,	0xFFFF00FF,	"pac4 audio file\n",	OCTET},
+	{0xBA010000,	0xFFFFFFFF,	"mpeg system stream\n",	OCTET},
+	{0x43614c66,	0xFFFFFFFF,	"FLAC audio file\n",	OCTET},
+	{0x30800CC0,	0xFFFFFFFF,	"inferno .dis executable\n", OCTET},
+	{0x04034B50,	0xFFFFFFFF,	"zip archive\n", "application/zip"},
+	{070707,	0xFFFF,		"cpio archive\n", OCTET},
+	{0x2F7,		0xFFFF,		"tex dvi\n", "application/dvi"},
+	{0xfaff,	0xfeff,		"mp3 audio\n",	"audio/mpeg"},
+	{0xf0ff,	0xf6ff,		"aac audio\n",	"audio/mpeg"},
+	{0xfeff0000,	0xffffffff,	"utf-32be\n",	"text/plain charset=utf-32be"},
+	{0xfffe,	0xffffffff,	"utf-32le\n",	"text/plain charset=utf-32le"},
+	{0xfeff,	0xffff,		"utf-16be\n",	"text/plain charset=utf-16be"},
+	{0xfffe,	0xffff,		"utf-16le\n",	"text/plain charset=utf-16le"},
 	/* 0xfeedface: this could alternately be a Next Plan 9 boot image */
-	0xcefaedfe,	0xFFFFFFFF,	"32-bit power Mach-O executable\n", OCTET,
+	{0xcefaedfe,	0xFFFFFFFF,	"32-bit power Mach-O executable\n", OCTET},
 	/* 0xfeedfacf */
-	0xcffaedfe,	0xFFFFFFFF,	"64-bit power Mach-O executable\n", OCTET,
+	{0xcffaedfe,	0xFFFFFFFF,	"64-bit power Mach-O executable\n", OCTET},
 	/* 0xcefaedfe */
-	0xfeedface,	0xFFFFFFFF,	"386 Mach-O executable\n", OCTET,
+	{0xfeedface,	0xFFFFFFFF,	"386 Mach-O executable\n", OCTET},
 	/* 0xcffaedfe */
-	0xfeedfacf,	0xFFFFFFFF,	"amd64 Mach-O executable\n", OCTET,
+	{0xfeedfacf,	0xFFFFFFFF,	"amd64 Mach-O executable\n", OCTET},
 	/* 0xcafebabe */
-	0xbebafeca,	0xFFFFFFFF,	"Mach-O universal executable\n", OCTET,
+	{0xbebafeca,	0xFFFFFFFF,	"Mach-O universal executable\n", OCTET},
 	/*
 	 * these magic numbers are stored big-endian on disk,
 	 * thus the numbers appear reversed in this table.
 	 */
-	0xad4e5cd1,	0xFFFFFFFF,	"venti arena\n", OCTET,
-	0x2bb19a52,	0xFFFFFFFF,	"paq archive\n", OCTET,
+	{0xad4e5cd1,	0xFFFFFFFF,	"venti arena\n", OCTET},
+	{0x2bb19a52,	0xFFFFFFFF,	"paq archive\n", OCTET},
 };
 
 int
@@ -604,10 +604,10 @@ Fileoffmag longofftab[] = {
 	 * these magic numbers are stored big-endian on disk,
 	 * thus the numbers appear reversed in this table.
 	 */
-	256*1024, { 0xe7a5e4a9, 0xFFFFFFFF, "venti arenas partition\n", OCTET },
-	256*1024, { 0xc75e5cd1, 0xFFFFFFFF, "venti index section\n", OCTET },
-	128*1024, { 0x89ae7637, 0xFFFFFFFF, "fossil write buffer\n", OCTET },
-	4,	  { 0x31647542, 0xFFFFFFFF, "OS X finder properties\n", OCTET },
+	{256*1024, { 0xe7a5e4a9, 0xFFFFFFFF, "venti arenas partition\n", OCTET }},
+	{256*1024, { 0xc75e5cd1, 0xFFFFFFFF, "venti index section\n", OCTET }},
+	{128*1024, { 0x89ae7637, 0xFFFFFFFF, "fossil write buffer\n", OCTET }},
+	{4,	  { 0x31647542, 0xFFFFFFFF, "OS X finder properties\n", OCTET }},
 };
 
 int
@@ -729,65 +729,65 @@ struct	FILE_STRING
 	char	*mime;
 } file_string[] =
 {
-	"!<arch>\n__.SYMDEF",	"archive random library",	16,	"application/octet-stream",
-	"!<arch>\n",		"archive",			8,	"application/octet-stream",
-	"070707",		"cpio archive - ascii header",	6,	"application/octet-stream",
-	"#!/bin/rc",		"rc executable file",		9,	"text/plain",
-	"#!/bin/sh",		"sh executable file",		9,	"text/plain",
-	"%!",			"postscript",			2,	"application/postscript",
-	"\004%!",		"postscript",			3,	"application/postscript",
-	"x T post",		"troff output for post",	8,	"application/troff",
-	"x T Latin1",		"troff output for Latin1",	10,	"application/troff",
-	"x T utf",		"troff output for UTF",		7,	"application/troff",
-	"x T 202",		"troff output for 202",		7,	"application/troff",
-	"x T aps",		"troff output for aps",		7,	"application/troff",
-	"x T ",			"troff output",			4,	"application/troff",
-	"GIF",			"GIF image", 			3,	"image/gif",
-	"\0PC Research, Inc\0",	"ghostscript fax file",		18,	"application/ghostscript",
-	"%PDF",			"PDF",				4,	"application/pdf",
-	"<html>\n",		"HTML file",			7,	"text/html",
-	"<HTML>\n",		"HTML file",			7,	"text/html",
-	"\111\111\052\000",	"tiff",				4,	"image/tiff",
-	"\115\115\000\052",	"tiff",				4,	"image/tiff",
-	"\377\330\377\340",	"jpeg",				4,	"image/jpeg",
-	"\377\330\377\341",	"jpeg",				4,	"image/jpeg",
-	"\377\330\377\333",	"jpeg",				4,	"image/jpeg",
-	"BM",			"bmp",				2,	"image/bmp",
-	"\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1",	"microsoft office document",	8,	"application/octet-stream",
-	"<MakerFile ",		"FrameMaker file",		11,	"application/framemaker",
-	"\033E\033",	"HP PCL printer data",		3,	OCTET,
-	"\033&",	"HP PCL printer data",		2,	OCTET,
-	"\033%-12345X",	"HPJCL file",		9,	"application/hpjcl",
-	"\033Lua",		"Lua bytecode",		4,	OCTET,
-	"ID3",			"mp3 audio with id3",	3,	"audio/mpeg",
-	"\211PNG",		"PNG image",		4,	"image/png",
-	"P3\n",			"ppm",				3,	"image/ppm",
-	"P6\n",			"ppm",				3,	"image/ppm",
-	"/* XPM */\n",	"xbm",				10,	"image/xbm",
-	".HTML ",		"troff -ms input",	6,	"text/troff",
-	".LP",			"troff -ms input",	3,	"text/troff",
-	".ND",			"troff -ms input",	3,	"text/troff",
-	".PP",			"troff -ms input",	3,	"text/troff",
-	".TL",			"troff -ms input",	3,	"text/troff",
-	".TR",			"troff -ms input",	3,	"text/troff",
-	".TH",			"manual page",		3,	"text/troff",
-	".\\\"",		"troff input",		3,	"text/troff",
-	".de",			"troff input",		3,	"text/troff",
-	".if",			"troff input",		3,	"text/troff",
-	".nr",			"troff input",		3,	"text/troff",
-	".tr",			"troff input",		3,	"text/troff",
-	"vac:",			"venti score",		4,	"text/plain",
-	"-----BEGIN CERTIFICATE-----\n",
-				"pem certificate",	-1,	"text/plain",
-	"-----BEGIN TRUSTED CERTIFICATE-----\n",
-				"pem trusted certificate", -1,	"text/plain",
-	"-----BEGIN X509 CERTIFICATE-----\n",
-				"pem x.509 certificate", -1,	"text/plain",
-	"subject=/C=",		"pem certificate with header", -1, "text/plain",
-	"process snapshot ",	"process snapshot",	-1,	"application/snapfs",
-	"BEGIN:VCARD\r\n",	"vCard",		13,	"text/directory;profile=vcard",
-	"BEGIN:VCARD\n",	"vCard",		12,	"text/directory;profile=vcard",
-	0,0,0,0
+	{"!<arch>\n__.SYMDEF",	"archive random library",	16,	"application/octet-stream"},
+	{"!<arch>\n",		"archive",			8,	"application/octet-stream"},
+	{"070707",		"cpio archive - ascii header",	6,	"application/octet-stream"},
+	{"#!/bin/rc",		"rc executable file",		9,	"text/plain"},
+	{"#!/bin/sh",		"sh executable file",		9,	"text/plain"},
+	{"%!",			"postscript",			2,	"application/postscript"},
+	{"\004%!",		"postscript",			3,	"application/postscript"},
+	{"x T post",		"troff output for post",	8,	"application/troff"},
+	{"x T Latin1",		"troff output for Latin1",	10,	"application/troff"},
+	{"x T utf",		"troff output for UTF",		7,	"application/troff"},
+	{"x T 202",		"troff output for 202",		7,	"application/troff"},
+	{"x T aps",		"troff output for aps",		7,	"application/troff"},
+	{"x T ",		"troff output",			4,	"application/troff"},
+	{"GIF",			"GIF image", 			3,	"image/gif"},
+	{"\0PC Research, Inc\0","ghostscript fax file",		18,	"application/ghostscript"},
+	{"%PDF",		"PDF",				4,	"application/pdf"},
+	{"<html>\n",		"HTML file",			7,	"text/html"},
+	{"<HTML>\n",		"HTML file",			7,	"text/html"},
+	{"\111\111\052\000",	"tiff",				4,	"image/tiff"},
+	{"\115\115\000\052",	"tiff",				4,	"image/tiff"},
+	{"\377\330\377\340",	"jpeg",				4,	"image/jpeg"},
+	{"\377\330\377\341",	"jpeg",				4,	"image/jpeg"},
+	{"\377\330\377\333",	"jpeg",				4,	"image/jpeg"},
+	{"BM",			"bmp",				2,	"image/bmp"},
+	{"\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1",	"microsoft office document",	8,	"application/octet-stream"},
+	{"<MakerFile ",		"FrameMaker file",		11,	"application/framemaker"},
+	{"\033E\033",	"HP PCL printer data",		3,	OCTET},
+	{"\033&",	"HP PCL printer data",		2,	OCTET},
+	{"\033%-12345X",	"HPJCL file",		9,	"application/hpjcl"},
+	{"\033Lua",		"Lua bytecode",		4,	OCTET},
+	{"ID3",			"mp3 audio with id3",	3,	"audio/mpeg"},
+	{"\211PNG",		"PNG image",		4,	"image/png"},
+	{"P3\n",		"ppm",			3,	"image/ppm"},
+	{"P6\n",		"ppm",			3,	"image/ppm"},
+	{"/* XPM */\n",	"xbm",				10,	"image/xbm"},
+	{".HTML ",		"troff -ms input",	6,	"text/troff"},
+	{".LP",			"troff -ms input",	3,	"text/troff"},
+	{".ND",			"troff -ms input",	3,	"text/troff"},
+	{".PP",			"troff -ms input",	3,	"text/troff"},
+	{".TL",			"troff -ms input",	3,	"text/troff"},
+	{".TR",			"troff -ms input",	3,	"text/troff"},
+	{".TH",			"manual page",		3,	"text/troff"},
+	{".\\\"",		"troff input",		3,	"text/troff"},
+	{".de",			"troff input",		3,	"text/troff"},
+	{".if",			"troff input",		3,	"text/troff"},
+	{".nr",			"troff input",		3,	"text/troff"},
+	{".tr",			"troff input",		3,	"text/troff"},
+	{"vac:",			"venti score",		4,	"text/plain"},
+	{"-----BEGIN CERTIFICATE-----\n",
+				"pem certificate",	-1,	"text/plain"},
+	{"-----BEGIN TRUSTED CERTIFICATE-----\n",
+				"pem trusted certificate", -1,	"text/plain"},
+	{"-----BEGIN X509 CERTIFICATE-----\n",
+				"pem x.509 certificate", -1,	"text/plain"},
+	{"subject=/C=",		"pem certificate with header", -1, "text/plain"},
+	{"process snapshot ",	"process snapshot",	-1,	"application/snapfs"},
+	{"BEGIN:VCARD\r\n",	"vCard",		13,	"text/directory;profile=vcard"},
+	{"BEGIN:VCARD\n",	"vCard",		12,	"text/directory;profile=vcard"},
+	{0,0,0,0}
 };
 
 int
@@ -827,8 +827,8 @@ struct offstr
 	uint32_t	off;
 	struct FILE_STRING FILE_STRING;
 } offstrs[] = {
-	32*1024, { "\001CD001\001",	"ISO9660 CD image",	7,	OCTET },
-	0, { 0, 0, 0, 0 }
+	{32*1024, { "\001CD001\001",	"ISO9660 CD image",	7,	OCTET }},
+	{0, { 0, 0, 0, 0 }}
 };
 
 int
@@ -1340,7 +1340,7 @@ isp9font(void)
 		return 0;
 	if (!getfontnum(cp, &cp))	/* ascent */
 		return 0;
-	for (i = 0; cp=(uint8_t*)strchr((char*)cp, '\n'); i++) {
+	for (i = 0; (cp=(uint8_t*)strchr((char*)cp, '\n')) != nil; i++) {
 		if (!getfontnum(cp, &cp))	/* min */
 			break;
 		if (!getfontnum(cp, &cp))	/* max */

+ 1 - 1
sys/src/cmd/fossil/9proc.c

@@ -697,7 +697,7 @@ fidMergeSort(Fid *f)
 			delay = 0;
 		else
 			a = a->sort;
-		if(b = b->sort)
+		if((b = b->sort) != nil)
 			b = b->sort;
 	}
 

+ 15 - 15
sys/src/cmd/fossil/Ccmd.c

@@ -208,20 +208,20 @@ struct Cmd9p {
 };
 
 static Cmd9p cmd9pTmsg[] = {
-	"Tversion", Tversion, 2, "msize version", cmd9pTversion,
-	"Tauth", Tauth, 3, "afid uname aname", cmd9pTauth,
-	"Tflush", Tflush, 1, "oldtag", cmd9pTflush,
-	"Tattach", Tattach, 4, "fid afid uname aname", cmd9pTattach,
-	"Twalk", Twalk, 0, "fid newfid [name...]", cmd9pTwalk,
-	"Topen", Topen, 2, "fid mode", cmd9pTopen,
-	"Tcreate", Tcreate, 4, "fid name perm mode", cmd9pTcreate,
-	"Tread", Tread, 3, "fid offset count", cmd9pTread,
-	"Twrite", Twrite, 3, "fid offset data", cmd9pTwrite,
-	"Tclunk", Tclunk, 1, "fid", cmd9pTclunk,
-	"Tremove", Tremove, 1, "fid", cmd9pTremove,
-	"Tstat", Tstat, 1, "fid", cmd9pTstat,
-	"Twstat", Twstat, 7, "fid name uid gid mode mtime length", cmd9pTwstat,
-	"nexttag", 0, 0, "", cmd9pTag,
+	{"Tversion", Tversion, 2, "msize version", cmd9pTversion},
+	{"Tauth", Tauth, 3, "afid uname aname", cmd9pTauth},
+	{"Tflush", Tflush, 1, "oldtag", cmd9pTflush},
+	{"Tattach", Tattach, 4, "fid afid uname aname", cmd9pTattach},
+	{"Twalk", Twalk, 0, "fid newfid [name...]", cmd9pTwalk},
+	{"Topen", Topen, 2, "fid mode", cmd9pTopen},
+	{"Tcreate", Tcreate, 4, "fid name perm mode", cmd9pTcreate},
+	{"Tread", Tread, 3, "fid offset count", cmd9pTread},
+	{"Twrite", Twrite, 3, "fid offset data", cmd9pTwrite},
+	{"Tclunk", Tclunk, 1, "fid", cmd9pTclunk},
+	{"Tremove", Tremove, 1, "fid", cmd9pTremove},
+	{"Tstat", Tstat, 1, "fid", cmd9pTstat},
+	{"Twstat", Twstat, 7, "fid name uid gid mode mtime length", cmd9pTwstat},
+	{"nexttag", 0, 0, "", cmd9pTag},
 };
 
 static int
@@ -426,7 +426,7 @@ cmdBind(int argc, char* argv[])
 		return cliError(usage);
 	}ARGEND
 
-	if(argc != 2 || (flag&MAFTER)&&(flag&MBEFORE))
+	if(argc != 2 || ((flag&MAFTER)&&(flag&MBEFORE)))
 		return cliError(usage);
 
 	if(bind(argv[0], argv[1], flag) < 0){

+ 2 - 2
sys/src/cmd/freq.c

@@ -115,8 +115,8 @@ freq(int f, char *s)
 			Bprint(&bout, "%.2lx ", i);
 		if(flag & Fchar) {
 			if(i <= 0x20 ||
-			   i >= 0x7f && i < 0xa0 ||
-			   i > 0xff && !(flag & Frune))
+			   (i >= 0x7f && i < 0xa0) ||
+			   (i > 0xff && !(flag & Frune)))
 				Bprint(&bout, "- ");
 			else
 				Bprint(&bout, "%C ", (int)i);

+ 23 - 22
sys/src/cmd/gview.c

@@ -208,23 +208,23 @@ typedef struct color_ref {
 } color_ref;
 
 color_ref clrtab[] = {
-	DRed,		"Red",		'R', 0,
-	DPink,		"Pink",		'P', 0,
-	DDkred,		"Dkred",	'r', 0,
-	DOrange,	"Orange",	'O', 0,
-	DYellow,	"Yellow",	'Y', 0,
-	DDkyellow,	"Dkyellow",	'y', 0,
-	DGreen,		"Green",	'G', 0,
-	DDkgreen,	"Dkgreen",	'g', 0,
-	DCyan,		"Cyan",		'C', 0,
-	DBlue,		"Blue",		'B', 0,
-	DLtblue,	"Ltblue",	'b', 0,
-	DMagenta,	"Magenta",	'M', 0,
-	DViolet,	"Violet",	'V', 0,
-	Dgray,		"Gray",		'A', 0,
-	DBlack,		"Black",	'K', 0,
-	DWhite,		"White",	'W', 0,
-	DNofill,	0,		0,   0	/* DNofill means "end of data" */
+	{DRed,		"Red",		'R', 0},
+	{DPink,		"Pink",		'P', 0},
+	{DDkred,	"Dkred",	'r', 0},
+	{DOrange,	"Orange",	'O', 0},
+	{DYellow,	"Yellow",	'Y', 0},
+	{DDkyellow,	"Dkyellow",	'y', 0},
+	{DGreen,	"Green",	'G', 0},
+	{DDkgreen,	"Dkgreen",	'g', 0},
+	{DCyan,		"Cyan",		'C', 0},
+	{DBlue,		"Blue",		'B', 0},
+	{DLtblue,	"Ltblue",	'b', 0},
+	{DMagenta,	"Magenta",	'M', 0},
+	{DViolet,	"Violet",	'V', 0},
+	{Dgray,		"Gray",		'A', 0},
+	{DBlack,	"Black",	'K', 0},
+	{DWhite,	"White",	'W', 0},
+	{DNofill,	0,		0,   0}	/* DNofill means "end of data" */
 };
 
 int16_t nam1_idx[128];			/* the clrtab[] index for each nam1, else -1 */
@@ -298,10 +298,11 @@ thick_color* parse_color_chars(const char* c0, const char* fin,
 	i = 0;
 	for (c=c0; c<fin && i<n; c++) {
 		tc[++i].thick = 0;
-		if (*c=='T')
+		if (*c=='T') {
 			if (++c==fin)
 				return tc_default(tc);
 			else tc[i].thick=1;
+		}
 		j = (*c&~127) ? -1 : nam1_idx[(uint8_t)*c];
 		if (j < 0)
 			return tc_default(tc);
@@ -392,7 +393,7 @@ typedef struct frectangle {
 	fpoint min, max;
 } frectangle;
 
-frectangle empty_frect = {1e30, 1e30, -1e30, -1e30};
+frectangle empty_frect = {{1e30, 1e30}, {-1e30, -1e30}};
 
 
 /* When *r2 is transformed by y=y-x*slant, might it intersect *r1 ?
@@ -458,9 +459,9 @@ typedef struct fpolygons {
 
 
 fpolygons univ = {			/* everything there is to display */
-	0,
-	1e30, 1e30, -1e30, -1e30,
-	0, 0, 0, 0,
+	nil,
+	{{1e30, 1e30}, {-1e30, -1e30}},
+	{{0, 0}, {0, 0}},
 	2*1e30
 };
 

+ 2 - 2
sys/src/cmd/hget.c

@@ -288,7 +288,7 @@ crackurl(URL *u, char *s)
 		*p = '/';
 	}
 
-	if(p = strchr(u->host, ':')) {
+	if((p = strchr(u->host, ':')) != nil){
 		*p++ = 0;
 		u->port = p;
 	} else
@@ -821,7 +821,7 @@ hhauth(char *p, URL *u, Range *r)
 	s = smprint("%s:%s", up->user, up->passwd);
 	if(enc64(cred, sizeof(cred), (uint8_t *)s, strlen(s)) == -1)
 		sysfatal("enc64");
-  		free(s);
+ 	free(s);
 
 	assert(u->cred = strdup(cred));
 }

+ 1 - 1
sys/src/cmd/history.c

@@ -349,7 +349,7 @@ starttime(char *s)
 		tm = localtime(t+dt);
 		if(yr > tm->year ||
 		  (yr == tm->year && mo > tm->mon) ||
-		  (yr == tm->year && mo == tm->mon) && da > tm->mday) {
+		  (yr == tm->year && mo == tm->mon && da > tm->mday)) {
 			t += dt;
 			continue;
 		}

+ 79 - 79
sys/src/cmd/html2ms.c

@@ -74,69 +74,69 @@ Action	g_br, g_hr;
 
 Goobie gtab[] =
 {
-	"!--",		g_ignore,	g_unexpected,
-	"!doctype",	g_ignore,	g_unexpected,
-	"a",		g_ignore,	g_ignore,
-	"address",	g_display,	g_displayend,
-	"b",		g_fpush,	g_fpop,
-	"base",		g_ignore,	g_unexpected,
-	"blink",	g_ignore,	g_ignore,
-	"blockquote",	g_ignore,	g_ignore,
-	"body",		g_ignore,	g_ignore,
-	"br",		g_br,		g_unexpected,
-	"caption",	g_caption,	g_captionend,
-	"center",	g_ignore,	g_ignore,
-	"cite",		g_ignore,	g_ignore,
-	"code",		g_ignore,	g_ignore,
-	"dd",		g_ignore,	g_unexpected,
-	"dfn",		g_ignore,	g_ignore,
-	"dir",		g_list,		g_listend,
-	"div",		g_ignore,		g_br,
-	"dl",		g_indent,	g_exdent,
-	"dt",		g_dt,		g_unexpected,
-	"em",		g_ignore,	g_ignore,
-	"font",		g_ignore,	g_ignore,
-	"form",		g_ignore,	g_ignore,
-	"h1",		g_h,		g_p,
-	"h2",		g_h,		g_p,
-	"h3",		g_h,		g_p,
-	"h4",		g_h,		g_p,
-	"h5",		g_h,		g_p,
-	"h6",		g_h,		g_p,
-	"head",		g_ignore,	g_ignore,
-	"hr",		g_hr,		g_unexpected,
-	"html",		g_ignore,	g_ignore,
-	"i",		g_fpush,	g_fpop,
-	"input",	g_ignore,	g_unexpected,
-	"img",		g_ignore,	g_unexpected,
-	"isindex",	g_ignore,	g_unexpected,
-	"kbd",		g_fpush,	g_fpop,
-	"key",		g_ignore,	g_ignore,
-	"li",		g_li,		g_unexpected,
-	"link",		g_ignore,	g_unexpected,
-	"listing",	g_ignore,	g_ignore,
-	"menu",		g_list,		g_listend,
-	"meta",		g_ignore,	g_unexpected,
-	"nextid",	g_ignore,	g_unexpected,
-	"ol",		g_list,		g_listend,
-	"option",	g_ignore,	g_unexpected,
-	"p",		g_p,		g_ignore,
-	"plaintext",	g_ignore,	g_unexpected,
-	"pre",		g_pre,		g_displayend,
-	"samp",		g_ignore,	g_ignore,
-	"script",	g_ignore,	g_ignore,
-	"select",	g_ignore,	g_ignore,
-	"span",		g_ignore,	g_ignore,
-	"strong",	g_ignore,	g_ignore,
-	"table",	g_table,	g_tableend,
-	"textarea",	g_ignore,	g_ignore,
-	"title",	g_title,	g_ignore,
-	"tt",		g_fpush,	g_fpop,
-	"u",		g_ignore,	g_ignore,
-	"ul",		g_list,		g_listend,
-	"var",		g_ignore,	g_ignore,
-	"xmp",		g_ignore,	g_ignore,
-	0,		0,	0,
+	{"!--",		g_ignore,	g_unexpected},
+	{"!doctype",	g_ignore,	g_unexpected},
+	{"a",		g_ignore,	g_ignore},
+	{"address",	g_display,	g_displayend},
+	{"b",		g_fpush,	g_fpop},
+	{"base",	g_ignore,	g_unexpected},
+	{"blink",	g_ignore,	g_ignore},
+	{"blockquote",	g_ignore,	g_ignore},
+	{"body",	g_ignore,	g_ignore},
+	{"br",		g_br,		g_unexpected},
+	{"caption",	g_caption,	g_captionend},
+	{"center",	g_ignore,	g_ignore},
+	{"cite",	g_ignore,	g_ignore},
+	{"code",	g_ignore,	g_ignore},
+	{"dd",		g_ignore,	g_unexpected},
+	{"dfn",		g_ignore,	g_ignore},
+	{"dir",		g_list,		g_listend},
+	{"div",		g_ignore,	g_br},
+	{"dl",		g_indent,	g_exdent},
+	{"dt",		g_dt,		g_unexpected},
+	{"em",		g_ignore,	g_ignore},
+	{"font",	g_ignore,	g_ignore},
+	{"form",	g_ignore,	g_ignore},
+	{"h1",		g_h,		g_p},
+	{"h2",		g_h,		g_p},
+	{"h3",		g_h,		g_p},
+	{"h4",		g_h,		g_p},
+	{"h5",		g_h,		g_p},
+	{"h6",		g_h,		g_p},
+	{"head",	g_ignore,	g_ignore},
+	{"hr",		g_hr,		g_unexpected},
+	{"html",	g_ignore,	g_ignore},
+	{"i",		g_fpush,	g_fpop},
+	{"input",	g_ignore,	g_unexpected},
+	{"img",		g_ignore,	g_unexpected},
+	{"isindex",	g_ignore,	g_unexpected},
+	{"kbd",		g_fpush,	g_fpop},
+	{"key",		g_ignore,	g_ignore},
+	{"li",		g_li,		g_unexpected},
+	{"link",	g_ignore,	g_unexpected},
+	{"listing",	g_ignore,	g_ignore},
+	{"menu",	g_list,		g_listend},
+	{"meta",	g_ignore,	g_unexpected},
+	{"nextid",	g_ignore,	g_unexpected},
+	{"ol",		g_list,		g_listend},
+	{"option",	g_ignore,	g_unexpected},
+	{"p",		g_p,		g_ignore},
+	{"plaintext",	g_ignore,	g_unexpected},
+	{"pre",		g_pre,		g_displayend},
+	{"samp",	g_ignore,	g_ignore},
+	{"script",	g_ignore,	g_ignore},
+	{"select",	g_ignore,	g_ignore},
+	{"span",	g_ignore,	g_ignore},
+	{"strong",	g_ignore,	g_ignore},
+	{"table",	g_table,	g_tableend},
+	{"textarea",	g_ignore,	g_ignore},
+	{"title",	g_title,	g_ignore},
+	{"tt",		g_fpush,	g_fpop},
+	{"u",		g_ignore,	g_ignore},
+	{"ul",		g_list,		g_listend},
+	{"var",		g_ignore,	g_ignore},
+	{"xmp",		g_ignore,	g_ignore},
+	{0,		0,		0},
 };
 
 typedef struct Entity Entity;
@@ -148,22 +148,22 @@ struct Entity
 
 Entity pl_entity[]=
 {
-"#SPACE", L' ', "#RS",   L'\n', "#RE",   L'\r', "quot",   L'"',
-"AElig",  L'Æ', "Aacute", L'Á', "Acirc",  L'Â', "Agrave", L'À', "Aring",  L'Å',
-"Atilde", L'Ã', "Auml",   L'Ä', "Ccedil", L'Ç', "ETH",    L'Ð', "Eacute", L'É',
-"Ecirc",  L'Ê', "Egrave", L'È', "Euml",   L'Ë', "Iacute", L'Í', "Icirc",  L'Î',
-"Igrave", L'Ì', "Iuml",   L'Ï', "Ntilde", L'Ñ', "Oacute", L'Ó', "Ocirc",  L'Ô',
-"Ograve", L'Ò', "Oslash", L'Ø', "Otilde", L'Õ', "Ouml",   L'Ö', "THORN",  L'Þ',
-"Uacute", L'Ú', "Ucirc",  L'Û', "Ugrave", L'Ù', "Uuml",   L'Ü', "Yacute", L'Ý',
-"aacute", L'á', "acirc",  L'â', "aelig",  L'æ', "agrave", L'à', "amp",    L'&',
-"aring",  L'å', "atilde", L'ã', "auml",   L'ä', "ccedil", L'ç', "eacute", L'é',
-"ecirc",  L'ê', "egrave", L'è', "eth",    L'ð', "euml",   L'ë', "gt",     L'>',
-"iacute", L'í', "icirc",  L'î', "igrave", L'ì', "iuml",   L'ï', "lt",     L'<',
-"nbsp", L' ',
-"ntilde", L'ñ', "oacute", L'ó', "ocirc",  L'ô', "ograve", L'ò', "oslash", L'ø',
-"otilde", L'õ', "ouml",   L'ö', "szlig",  L'ß', "thorn",  L'þ', "uacute", L'ú',
-"ucirc",  L'û', "ugrave", L'ù', "uuml",   L'ü', "yacute", L'ý', "yuml",   L'ÿ',
-0
+{"#SPACE", L' '},        {"#RS",   L'\n'},        {"#RE",    L'\r'},       {"quot",   L'"'},
+{"AElig",  L'Æ'}, {"Aacute", L'Á'}, {"Acirc",  L'Â'}, {"Agrave", L'À'}, {"Aring",  L'Å'},
+{"Atilde", L'Ã'}, {"Auml",   L'Ä'}, {"Ccedil", L'Ç'}, {"ETH",    L'Ð'}, {"Eacute", L'É'},
+{"Ecirc",  L'Ê'}, {"Egrave", L'È'}, {"Euml",   L'Ë'}, {"Iacute", L'Í'}, {"Icirc",  L'Î'},
+{"Igrave", L'Ì'}, {"Iuml",   L'Ï'}, {"Ntilde", L'Ñ'}, {"Oacute", L'Ó'}, {"Ocirc",  L'Ô'},
+{"Ograve", L'Ò'}, {"Oslash", L'Ø'}, {"Otilde", L'Õ'}, {"Ouml",   L'Ö'}, {"THORN",  L'Þ'},
+{"Uacute", L'Ú'}, {"Ucirc",  L'Û'}, {"Ugrave", L'Ù'}, {"Uuml",   L'Ü'}, {"Yacute", L'Ý'},
+{"aacute", L'á'}, {"acirc",  L'â'}, {"aelig",  L'æ'}, {"agrave", L'à'}, {"amp",    L'&'},
+{"aring",  L'å'}, {"atilde", L'ã'}, {"auml",   L'ä'}, {"ccedil", L'ç'}, {"eacute", L'é'},
+{"ecirc",  L'ê'}, {"egrave", L'è'}, {"eth",    L'ð'}, {"euml",   L'ë'}, {"gt",     L'>'},
+{"iacute", L'í'}, {"icirc",  L'î'}, {"igrave", L'ì'}, {"iuml",   L'ï'}, {"lt",     L'<'},
+{"nbsp", L' '},
+{"ntilde", L'ñ'}, {"oacute", L'ó'}, {"ocirc",  L'ô'}, {"ograve", L'ò'}, {"oslash", L'ø'},
+{"otilde", L'õ'}, {"ouml",   L'ö'}, {"szlig",  L'ß'}, {"thorn",  L'þ'}, {"uacute", L'ú'},
+{"ucirc",  L'û'}, {"ugrave", L'ù'}, {"uuml",   L'ü'}, {"yacute", L'ý'}, {"yuml",   L'ÿ'},
+{nil, 0}
 };
 
 int

+ 1 - 1
sys/src/cmd/import.c

@@ -416,7 +416,7 @@ filter(int fd, char *cmd, char *host)
 	argv[argc++] = buf;
 	argv[argc] = nil;
 	file = argv[0];
-	if (s = strrchr(argv[0], '/'))
+	if ((s = strrchr(argv[0], '/')) != nil)
 		argv[0] = s+1;
 
 	if(pipe(p) < 0)

+ 8 - 8
sys/src/cmd/join.c

@@ -91,7 +91,7 @@ main(int argc, char **argv)
 			break;
 		case 'o':
 			if(argv[1][2]!=0 ||
-			   argc>2 && strchr(argv[2],',')!=0)
+			   (argc>2 && strchr(argv[2],',')!=0))
 				oparse(getoptarg(&argc, &argv));
 			else for (no = 0; no<2*NFLD && argc>2; no++){
 				if (argv[2][0] == '1' && argv[2][1] == '.') {
@@ -215,15 +215,15 @@ join(int seekf)
 	top = 0;
 	bot = Boffset(f[seekf]);
 	readboth(n);
-	while(n[F1]>0 && n[F2]>0 || (a1||a2) && n[F1]+n[F2]>0) {
+	while((n[F1]>0 && n[F2]>0) || ((a1||a2) && n[F1]+n[F2]>0)) {
 		cmp = comp();
-		if(n[F1]>0 && n[F2]>0 && cmp>0 || n[F1]==0) {
+		if((n[F1]>0 && n[F2]>0 && cmp>0) || n[F1]==0) {
 			if(a2)
 				output(0, n[F2]);
 			if (seekf == F2)
 				bot = Boffset(f[seekf]);
 			n[F2] = input(F2);
-		} else if(n[F1]>0 && n[F2]>0 && cmp<0 || n[F2]==0) {
+		} else if((n[F1]>0 && n[F2]>0) && cmp<0 || n[F2]==0) {
 			if(a1)
 				output(n[F1], 0);
 			if (seekf == F1)
@@ -243,8 +243,8 @@ join(int seekf)
 				if(n[F1]>0 && n[F2]>0 && cmp==0) {
 					output(n[F1], n[F2]);
 					n[seekf] = input(seekf);
-				} else if(n[F1]>0 && n[F2]>0 &&
-				    (less? cmp<0 :cmp>0) || n[seekf]==0)
+				} else if((n[F1]>0 && n[F2]>0 &&
+				    (less? cmp<0 :cmp>0)) || n[seekf]==0)
 					seekbotreadboth(seekf, bot, n);
 				else {
 					/*
@@ -330,8 +330,8 @@ output(int on1, int on2)	/* print items from olist */
 				temp = ppi[F2][j2];
 			else {
 				temp = ppi[olistf[i]][olist[i]];
-				if(olistf[i]==F1 && on1<=olist[i] ||
-				   olistf[i]==F2 && on2<=olist[i] ||
+				if((olistf[i]==F1 && on1<=olist[i]) ||
+				   (olistf[i]==F2 && on2<=olist[i]) ||
 				   *temp==0)
 					temp = null;
 			}

+ 1 - 1
sys/src/cmd/kiss.c

@@ -40,7 +40,7 @@ main(int _, char *__)
 	i = 0;
 	argv[0] = line;
 	while (1) {
-		if (amt = read(0, &line[i], 1) < 1) {
+		if ((amt = read(0, &line[i], 1)) < 1) {
 			print("read: %r\n");
 			break;
 		}

+ 3 - 3
sys/src/cmd/ktrace.c

@@ -57,7 +57,7 @@ printaddr(char *addr, uint64_t pc)
 		}
 	}
 
-	if(p=strchr(addr, '+')){
+	if((p=strchr(addr, '+')) != nil){
 		*p++ = 0;
 		print("src(%#.8llux); // %s+0x%s\n", pc, addr, p);
 	}else
@@ -362,11 +362,11 @@ readstack(void)
 	int nf, i;
 
 	Binit(&b, 0, OREAD);
-	while(p=Brdline(&b, '\n')){
+	while((p=Brdline(&b, '\n')) != nil){
 		p[Blinelen(&b)-1] = 0;
 		nf = tokenize(p, f, nelem(f));
 		for(i=0; i<nf; i++){
-			if(p=strchr(f[i], '=')){
+			if((p=strchr(f[i], '=')) != nil){
 				*p++ = 0;
 				putval(strtoull(f[i], 0, 16), strtoull(p, 0, 16));
 			}

+ 2 - 2
sys/src/cmd/look.c

@@ -308,7 +308,7 @@ ncomp(Rune *s, Rune *t)
 	a = 0;
 	if(ssgn == tsgn)
 		while(it>t && is>s)
-			if(b = *--it - *--is)
+			if((b = *--it - *--is) != 0)
 				a = b;
 	while(is > s)
 		if(*--is != '0')
@@ -324,7 +324,7 @@ ncomp(Rune *s, Rune *t)
 		t++;
 	if(ssgn == tsgn)
 		while(isdigit(*s) && isdigit(*t))
-			if(a = *t++ - *s++)
+			if((a = *t++ - *s++) != 0)
 				return sgn(a)*ssgn;
 	while(isdigit(*s))
 		if(*s++ != '0')

+ 2 - 2
sys/src/cmd/ms2html.c

@@ -2403,7 +2403,7 @@ iftest(char *p, char **bp)
 		p++;
 	}
 	c = *p;
-	if (c >= '0' && c <= '9' || c == '+' || c == '-' || c == '('/*)*/) {
+	if ((c >= '0' && c <= '9') || c == '+' || c == '-' || c == '('/*)*/) {
 		if (numval(&p,1) >= 1)
 			rv = 1;
 		goto done;
@@ -2521,7 +2521,7 @@ g_ie(char *line, char *e)
 		fprint(2, "ms2html: .ie's too deep\n");
 		return;
 	}
-	if (ifwastrue[++elsetop] = ifstart(line, e, &b))
+	if ((ifwastrue[++elsetop] = ifstart(line, e, &b)) != 0)
 		pushbody(b);
 	else
 		skipbody(b);

+ 1 - 1
sys/src/cmd/pr.c

@@ -365,7 +365,7 @@ putpage(void)
 			}
 			for(Lcolpos=0, Pcolpos=0; C!='\n' && C!='\f' && C!=-1; get(colno))
 					put(C);
-			if(C==-1 || ++colno==Ncols || C=='\n' && get(colno)==-1)
+			if(C==-1 || ++colno==Ncols || (C=='\n' && get(colno)==-1))
 				break;
 			if(Sepc)
 				put(Sepc);

+ 2 - 2
sys/src/cmd/sed.c

@@ -1057,7 +1057,7 @@ dosub(Rune *rhsbuf)
 	rp = rhsbuf;
 	while (lp < loc1)
 		*sp++ = *lp++;
-	while((c = *rp++) != nil){
+	while((c = *rp++) != 0){
 		if (c == '&') {
 			sp = place(sp, loc1, loc2);
 			continue;
@@ -1311,7 +1311,7 @@ wcom:
 		spend = p2 - 1;
 		p1 = genbuf;
 		p2 = holdsp;
-		while(*p2++ = *p1++)
+		while((*p2++ = *p1++) != 0)
 			;
 		hspend = p2 - 1;
 		break;

+ 4 - 4
sys/src/cmd/sha1sum.c

@@ -25,10 +25,10 @@ struct Sha2 {
 };
 
 static Sha2 sha2s[] = {
-	224,	SHA2_224dlen,	sha2_224,
-	256,	SHA2_256dlen,	sha2_256,
-	384,	SHA2_384dlen,	sha2_384,
-	512,	SHA2_512dlen,	sha2_512,
+	{224,	SHA2_224dlen,	sha2_224},
+	{256,	SHA2_256dlen,	sha2_256},
+	{384,	SHA2_384dlen,	sha2_384},
+	{512,	SHA2_512dlen,	sha2_512},
 };
 
 static DigestState* (*shafunc)(uint8_t *, uint32_t, uint8_t *,

+ 2 - 2
sys/src/cmd/sort.c

@@ -734,7 +734,7 @@ doargs(int argc, char *argv[])
 				continue;
 			}
 
-			while(c = *s++)
+			while((c = *s++) != '\0')
 			switch(c) {
 			case '-':	/* end of options */
 				i = argc;
@@ -1666,7 +1666,7 @@ rsort4(Key ***a, uint32_t n, int b)
 	b++;
 	t = a + clist[0];
 	count[256] = 0;
-	for(cp1=clist+1; n=cp1[0]; cp1+=2) {
+	for(cp1=clist+1; (n=cp1[0]) != 0; cp1+=2) {
 		if(n > Threshold)
 			rsort4(t, n, b);
 		else

+ 1 - 1
sys/src/cmd/split.c

@@ -181,7 +181,7 @@ fold(char *s, int n)
 		fline = realloc(fline,n+1);
 		linesize = n+1;
 	}
-	for(t=fline; *t++ = tolower(*s++); )
+	for(t=fline; (*t++ = tolower(*s++)) != '\0'; )
 		continue;
 		/* we assume the 'A'-'Z' only appear as themselves
 		 * in a utf encoding.

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

@@ -119,10 +119,10 @@ typedef struct {
 } Compress;
 
 static Compress comps[] = {
-	"gzip",		"gunzip",	{ ".tar.gz", ".tgz" },	/* default */
-	"compress",	"uncompress",	{ ".tar.Z",  ".tz" },
-	"bzip2",	"bunzip2",	{ ".tar.bz", ".tbz",
-					  ".tar.bz2",".tbz2" },
+	{"gzip",	"gunzip",	{ ".tar.gz", ".tgz" }},	/* default */
+	{"compress",	"uncompress",	{ ".tar.Z",  ".tz" }},
+	{"bzip2",	"bunzip2",	{ ".tar.bz", ".tbz",
+					  ".tar.bz2",".tbz2" }},
 };
 
 typedef struct {
@@ -1186,13 +1186,14 @@ extract1(int ar, Hdr *hp, char *fname)
 		blksleft = 0;
 		break;
 	}
-	if (relative)
+	if (relative) {
 		if(fname[0] == '/')
 			*--fname = '.';
 		else if(fname[0] == '#'){
 			*--fname = '/';
 			*--fname = '.';
 		}
+	}
 
 	if (verb == Xtract)
 		fd = openfname(hp, fname, dir, mode);

+ 2 - 1
sys/src/cmd/tweak.c

@@ -1792,13 +1792,14 @@ tread(Thing *t)
 	free(t->name);
 	free(t);
 	for(nt=thing; nt; nt=nt->next)
-		if(nt==new || nt->parent==new)
+		if(nt==new || nt->parent==new){
 			if(nclosed == 0)
 				drawthing(nt, 0);	/* can draw in place */
 			else{
 				redraw(nt);	/* must redraw all below */
 				break;
 			}
+		}
 }
 
 void

+ 13 - 13
sys/src/cmd/webcookies.c

@@ -65,23 +65,23 @@ struct {
 	int	offset;
 	int	ishttp;
 } stab[] = {
-	"domain",		offsetof(Cookie, dom),		1,
-	"path",			offsetof(Cookie, path),		1,
-	"name",			offsetof(Cookie, name),		0,
-	"value",		offsetof(Cookie, value),	0,
-	"comment",		offsetof(Cookie, comment),	1,
-	"version",		offsetof(Cookie, version),	1,
+	{"domain",		offsetof(Cookie, dom),		1},
+	{"path",		offsetof(Cookie, path),		1},
+	{"name",		offsetof(Cookie, name),		0},
+	{"value",		offsetof(Cookie, value),	0},
+	{"comment",		offsetof(Cookie, comment),	1},
+	{"version",		offsetof(Cookie, version),	1},
 };
 
 struct {
 	char *s;
 	int	offset;
 } itab[] = {
-	"expire",		offsetof(Cookie, expire),
-	"secure",		offsetof(Cookie, secure),
-	"explicitdomain",	offsetof(Cookie, explicitdom),
-	"explicitpath",		offsetof(Cookie, explicitpath),
-	"netscapestyle",	offsetof(Cookie, netscapestyle),
+	{"expire",		offsetof(Cookie, expire)},
+	{"secure",		offsetof(Cookie, secure)},
+	{"explicitdomain",	offsetof(Cookie, explicitdom)},
+	{"explicitpath",	offsetof(Cookie, explicitpath)},
+	{"netscapestyle",	offsetof(Cookie, netscapestyle)},
 };
 
 
@@ -608,8 +608,8 @@ strtotime(char *s)
 	Tm tm;
 
 	static int mday[2][12] = {
-		31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
-		31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31,
+		{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
+		{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
 	};
 	static char *wday[] = {
 		"Sunday", "Monday", "Tuesday", "Wednesday",

+ 10 - 10
sys/src/cmd/xd.c

@@ -52,25 +52,25 @@ fmtfn *fmt[4] = {
 };
 
 char *dfmt[4][3] = {
-	" %.3o",	" %.3u",	" %.2x",
-	" %.6o",	" %.5u",	" %.4x",
-	" %.11lo",	" %.10lu",	" %.8lx",
-	" %.22llo",	" %.20llu",	" %.16llx",
+	{" %.3o",	" %.3u",	" %.2x"},
+	{" %.6o",	" %.5u",	" %.4x"},
+	{" %.11lo",	" %.10lu",	" %.8lx"},
+	{" %.22llo",	" %.20llu",	" %.16llx"},
 };
 
 char *cfmt[3][3] = {
-	"   %c",	"   %c", 	"  %c",
-	" %.3s",	" %.3s",	" %.2s",
-	" %.3o",	" %.3u",	" %.2x",
+	{"   %c",	"   %c", 	"  %c"},
+	{" %.3s",	" %.3s",	" %.2s"},
+	{" %.3o",	" %.3u",	" %.2x"},
 };
 
 char *rfmt[1][1] = {
-	" %2.2C",
+	{" %2.2C"},
 };
 
 char *afmt[2][3] = {
-	"%.7lo ",	"%.7lu ",	"%.7lx ",
-	"%7lo ",	"%7lu ",	"%7lx ",
+	{"%.7lo ",	"%.7lu ",	"%.7lx "},
+	{"%7lo ",	"%7lu ",	"%7lx "},
 };
 
 Biobuf	bin;