fix clang warnings reported by Tuncer Ayaz

R=rsc
http://codereview.appspot.com/6744054
diff --git a/lib/yaccpars b/lib/yaccpars
index 2b69c8a..532f50b 100644
--- a/lib/yaccpars
+++ b/lib/yaccpars
@@ -125,7 +125,8 @@
 	yychar = -1;
 	yynerrs = 0;
 	yyerrflag = 0;
-	yyp = &yys[-1];
+	yyp = &yys[0];
+	yyp--;
 	goto yystack;
 
 ret0:
diff --git a/src/cmd/astro/jup.c b/src/cmd/astro/jup.c
index a335338..e407234 100644
--- a/src/cmd/astro/jup.c
+++ b/src/cmd/astro/jup.c
@@ -16,8 +16,6 @@
 	anom = 225.22165 + .0830912*eday - .0484*capt;
 	motion = 299.1284/3600.;
 
-
-	anom = anom;
 	incl *= radian;
 	node *= radian;
 	argp *= radian;
diff --git a/src/cmd/auth/dsasign.c b/src/cmd/auth/dsasign.c
index 1387dab..913385f 100644
--- a/src/cmd/auth/dsasign.c
+++ b/src/cmd/auth/dsasign.c
@@ -146,6 +146,7 @@
 		fmtprint(&fmt, "%s\n", p);
 	}
 	sysfatal("did not find end of message");
+	return; // silence clang warning
 
 end:
 	text = fmtstrflush(&fmt);
diff --git a/src/cmd/auth/factotum/chap.c b/src/cmd/auth/factotum/chap.c
index b27f64a..fa44db9 100644
--- a/src/cmd/auth/factotum/chap.c
+++ b/src/cmd/auth/factotum/chap.c
@@ -122,6 +122,7 @@
 	chal = nil;
 	k = nil;
 	attr = c->attr;
+	res = nil;
 
 	if(c->proto == &chap){
 		astype = AuthChap;
diff --git a/src/cmd/awk/run.c b/src/cmd/awk/run.c
index da3e437..b145758 100644
--- a/src/cmd/awk/run.c
+++ b/src/cmd/awk/run.c
@@ -1541,7 +1541,7 @@
 		return x;
 	default:	/* can't happen */
 		FATAL("illegal function type %d", t);
-		break;
+		return(NULL);
 	}
 	tempfree(x);
 	x = gettemp();
@@ -1584,8 +1584,6 @@
 
 Cell *nullproc(Node **a, int n)
 {
-	n = n;
-	a = a;
 	return 0;
 }
 
@@ -1683,7 +1681,6 @@
 	Cell *x;
 	int i, stat;
 
-	n = n;
 	x = execute(a[0]);
 	getsval(x);
 	for (i = 0; i < FOPEN_MAX; i++)
diff --git a/src/cmd/devdraw/x11-itrans.c b/src/cmd/devdraw/x11-itrans.c
index 7a4df24..b08601e 100644
--- a/src/cmd/devdraw/x11-itrans.c
+++ b/src/cmd/devdraw/x11-itrans.c
@@ -37,7 +37,7 @@
 	needstack(64*1024);	/* X has some *huge* buffers in openobject */
 		/* and they're even bigger on SuSE */
 	XLookupString((XKeyEvent*)e,NULL,0,&k,NULL);
-	if(k == k == NoSymbol)
+	if(k == NoSymbol)
 		return -1;
 
 	if(k&0xFF00){
diff --git a/src/cmd/draw/tweak.c b/src/cmd/draw/tweak.c
index 1ee5d14..9d7cd60 100644
--- a/src/cmd/draw/tweak.c
+++ b/src/cmd/draw/tweak.c
@@ -1211,7 +1211,7 @@
 	}
 	if(strcmp(tag, "but1")==0
 	|| strcmp(tag, "but2")==0){
-		if(buf[0]<'0' || '9'<buf[0] || (l=atoi(buf))<0 || l>255){
+		if(buf[0]<'0' || '9'<buf[0] || (long)(l=atoi(buf))<0 || l>255){
 			mesg("illegal value");
 			return;
 		}
@@ -1855,7 +1855,7 @@
 	c -= t->off;
 	d -= t->off;
 	while(c <= d){
-		if(c<0 || c>=t->s->n){
+		if((long)c<0 || c>=t->s->n){
 			mesg("0x%lux not in font %s", c+t->off, t->name);
 			return;
 		}
diff --git a/src/cmd/ndb/dblookup.c b/src/cmd/ndb/dblookup.c
index 7da4db5..ca73184 100755
--- a/src/cmd/ndb/dblookup.c
+++ b/src/cmd/ndb/dblookup.c
@@ -103,6 +103,7 @@
 	}
 
 	lock(&dblock);
+	rp = nil;
 	dp = dnlookup(name, class, 1);
 	if(opendatabase() < 0)
 		goto out;
diff --git a/src/cmd/ndb/dns.c b/src/cmd/ndb/dns.c
index 5e150b1..05a5dd4 100755
--- a/src/cmd/ndb/dns.c
+++ b/src/cmd/ndb/dns.c
@@ -517,10 +517,6 @@
 
 	if(job->request.newfid != job->request.fid){
 		/* clone fid */
-		if(job->request.newfid<0){
-			err = "clone newfid out of range";
-			goto send;
-		}
 		nmf = copyfid(mf, job->request.newfid);
 		if(nmf == nil){
 			err = "clone bad newfid";
diff --git a/src/cmd/postscript/tr2post/draw.c b/src/cmd/postscript/tr2post/draw.c
index ace749e..a7f6b22 100644
--- a/src/cmd/postscript/tr2post/draw.c
+++ b/src/cmd/postscript/tr2post/draw.c
@@ -105,8 +105,10 @@
 	r = Bgetrune(Bp);
 	switch(r) {
 	case 'l':
-		if (Bgetfield(Bp, 'd', &x1, 0)<=0 || Bgetfield(Bp, 'd', &y1, 0)<=0 || Bgetfield(Bp, 'r', &i, 0)<=0)
+		if (Bgetfield(Bp, 'd', &x1, 0)<=0 || Bgetfield(Bp, 'd', &y1, 0)<=0 || Bgetfield(Bp, 'r', &i, 0)<=0) {
 			error(FATAL, "draw line function, destination coordinates not found.\n");
+			return;
+		}
 
 		endstring();
 		if (pageon())
@@ -115,8 +117,10 @@
 		vpos += y1;
 		break;
 	case 'c':
-		if (Bgetfield(Bp, 'd', &d1, 0)<=0)
+		if (Bgetfield(Bp, 'd', &d1, 0)<=0) {
 			error(FATAL, "draw circle function, diameter coordinates not found.\n");
+			return;
+		}
 
 		endstring();
 		if (pageon())
@@ -124,8 +128,10 @@
 		hpos += d1;
 		break;
 	case 'e':
-		if (Bgetfield(Bp, 'd', &d1, 0)<=0 || Bgetfield(Bp, 'd', &d2, 0)<=0)
+		if (Bgetfield(Bp, 'd', &d1, 0)<=0 || Bgetfield(Bp, 'd', &d2, 0)<=0) {
 			error(FATAL, "draw ellipse function, diameter coordinates not found.\n");
+			return;
+		}
 
 		endstring();
 		if (pageon())
@@ -133,8 +139,10 @@
 		hpos += d1;
 		break;
 	case 'a':
-		if (Bgetfield(Bp, 'd', &x1, 0)<=0 || Bgetfield(Bp, 'd', &y1, 0)<=0 || Bgetfield(Bp, 'd', &x2, 0)<=0 || Bgetfield(Bp, 'd', &y2, 0)<=0)
+		if (Bgetfield(Bp, 'd', &x1, 0)<=0 || Bgetfield(Bp, 'd', &y1, 0)<=0 || Bgetfield(Bp, 'd', &x2, 0)<=0 || Bgetfield(Bp, 'd', &y2, 0)<=0) {
 			error(FATAL, "draw arc function, coordinates not found.\n");
+			return;
+		}
 
 		endstring();
 		if (pageon())
@@ -150,7 +158,7 @@
 		break;
 	default:
 		error(FATAL, "unknown draw function <%c>\n", r);
-		break;
+		return;
 	}
 }
 
diff --git a/src/cmd/rio/showevent/ShowEvent.c b/src/cmd/rio/showevent/ShowEvent.c
index f29968f..7af9ded 100644
--- a/src/cmd/rio/showevent/ShowEvent.c
+++ b/src/cmd/rio/showevent/ShowEvent.c
@@ -12,395 +12,395 @@
 static char *TorF(bool)
 int bool;
 {
-    switch (bool) {
-    case True:
-	return ("True");
+	switch (bool) {
+	case True:
+		return ("True");
 
-    case False:
-	return ("False");
+	case False:
+		return ("False");
 
-    default:
-	return ("?");
-    }
+	default:
+		return ("?");
+	}
 }
 
 /* Returns the string equivalent of a property notify state */
 static char *PropertyState(state)
 int state;
 {
-    switch (state) {
-    case PropertyNewValue:
-	return ("PropertyNewValue");
+	switch (state) {
+	case PropertyNewValue:
+		return ("PropertyNewValue");
 
-    case PropertyDelete:
-	return ("PropertyDelete");
+	case PropertyDelete:
+		return ("PropertyDelete");
 
-    default:
-	return ("?");
-    }
+	default:
+		return ("?");
+	}
 }
 
 /* Returns the string equivalent of a visibility notify state */
 static char *VisibilityState(state)
 int state;
 {
-    switch (state) {
-    case VisibilityUnobscured:
-	return ("VisibilityUnobscured");
+	switch (state) {
+	case VisibilityUnobscured:
+		return ("VisibilityUnobscured");
 
-    case VisibilityPartiallyObscured:
-	return ("VisibilityPartiallyObscured");
+	case VisibilityPartiallyObscured:
+		return ("VisibilityPartiallyObscured");
 
-    case VisibilityFullyObscured:
-	return ("VisibilityFullyObscured");
+	case VisibilityFullyObscured:
+		return ("VisibilityFullyObscured");
 
-    default:
-	return ("?");
-    }
+	default:
+		return ("?");
+	}
 }
 
 /* Returns the string equivalent of a timestamp */
 static char *ServerTime(time)
 Time time;
 {
-    unsigned long msec;
-    unsigned long sec;
-    unsigned long min;
-    unsigned long hr;
-    unsigned long day;
-    static char buffer[32];
+	unsigned long msec;
+	unsigned long sec;
+	unsigned long min;
+	unsigned long hr;
+	unsigned long day;
+	static char buffer[32];
 
-    msec = time % 1000;
-    time /= 1000;
-    sec = time % 60;
-    time /= 60;
-    min = time % 60;
-    time /= 60;
-    hr = time % 24;
-    time /= 24;
-    day = time;
+	msec = time % 1000;
+	time /= 1000;
+	sec = time % 60;
+	time /= 60;
+	min = time % 60;
+	time /= 60;
+	hr = time % 24;
+	time /= 24;
+	day = time;
 
-    sprintf(buffer, "%ld day%s %02ld:%02ld:%02ld.%03ld",
-      day, day == 1 ? "" : "(s)", hr, min, sec, msec);
-    return (buffer);
+	sprintf(buffer, "%ld day%s %02ld:%02ld:%02ld.%03ld",
+	  day, day == 1 ? "" : "(s)", hr, min, sec, msec);
+	return (buffer);
 }
 
 /* Simple structure to ease the interpretation of masks */
 typedef struct _MaskType {
-    unsigned int value;
-    char *string;
+	unsigned int value;
+	char *string;
 } MaskType;
 
 /* Returns the string equivalent of a mask of buttons and/or modifier keys */
 static char *ButtonAndOrModifierState(state)
 unsigned int state;
 {
-    static char buffer[256];
-    static MaskType masks[] = {
-	{Button1Mask, "Button1Mask"},
-	{Button2Mask, "Button2Mask"},
-	{Button3Mask, "Button3Mask"},
-	{Button4Mask, "Button4Mask"},
-	{Button5Mask, "Button5Mask"},
-	{ShiftMask, "ShiftMask"},
-	{LockMask, "LockMask"},
-	{ControlMask, "ControlMask"},
-	{Mod1Mask, "Mod1Mask"},
-	{Mod2Mask, "Mod2Mask"},
-	{Mod3Mask, "Mod3Mask"},
-	{Mod4Mask, "Mod4Mask"},
-	{Mod5Mask, "Mod5Mask"},
-    };
-    int num_masks = sizeof(masks) / sizeof(MaskType);
-    int i;
-    Boolean first = True;
+	static char buffer[256];
+	static MaskType masks[] = {
+		{Button1Mask, "Button1Mask"},
+		{Button2Mask, "Button2Mask"},
+		{Button3Mask, "Button3Mask"},
+		{Button4Mask, "Button4Mask"},
+		{Button5Mask, "Button5Mask"},
+		{ShiftMask, "ShiftMask"},
+		{LockMask, "LockMask"},
+		{ControlMask, "ControlMask"},
+		{Mod1Mask, "Mod1Mask"},
+		{Mod2Mask, "Mod2Mask"},
+		{Mod3Mask, "Mod3Mask"},
+		{Mod4Mask, "Mod4Mask"},
+		{Mod5Mask, "Mod5Mask"},
+	};
+	int num_masks = sizeof(masks) / sizeof(MaskType);
+	int i;
+	Boolean first = True;
 
-    buffer[0] = 0;
+	buffer[0] = 0;
 
-    for (i = 0; i < num_masks; i++)
-	if (state & masks[i].value)
-	    if (first) {
-		first = False;
-		strcpy(buffer, masks[i].string);
-	    } else {
-		strcat(buffer, " | ");
-		strcat(buffer, masks[i].string);
-	    }
-    return (buffer);
+	for (i = 0; i < num_masks; i++)
+		if (state & masks[i].value)
+			if (first) {
+				first = False;
+				strcpy(buffer, masks[i].string);
+			} else {
+				strcat(buffer, " | ");
+				strcat(buffer, masks[i].string);
+			}
+	return (buffer);
 }
 
 /* Returns the string equivalent of a mask of configure window values */
 static char *ConfigureValueMask(valuemask)
 unsigned int valuemask;
 {
-    static char buffer[256];
-    static MaskType masks[] = {
-	{CWX, "CWX"},
-	{CWY, "CWY"},
-	{CWWidth, "CWWidth"},
-	{CWHeight, "CWHeight"},
-	{CWBorderWidth, "CWBorderWidth"},
-	{CWSibling, "CWSibling"},
-	{CWStackMode, "CWStackMode"},
-    };
-    int num_masks = sizeof(masks) / sizeof(MaskType);
-    int i;
-    Boolean first = True;
+	static char buffer[256];
+	static MaskType masks[] = {
+		{CWX, "CWX"},
+		{CWY, "CWY"},
+		{CWWidth, "CWWidth"},
+		{CWHeight, "CWHeight"},
+		{CWBorderWidth, "CWBorderWidth"},
+		{CWSibling, "CWSibling"},
+		{CWStackMode, "CWStackMode"},
+	};
+	int num_masks = sizeof(masks) / sizeof(MaskType);
+	int i;
+	Boolean first = True;
 
-    buffer[0] = 0;
+	buffer[0] = 0;
 
-    for (i = 0; i < num_masks; i++)
-	if (valuemask & masks[i].value)
-	    if (first) {
-		first = False;
-		strcpy(buffer, masks[i].string);
-	    } else {
-		strcat(buffer, " | ");
-		strcat(buffer, masks[i].string);
-	    }
+	for (i = 0; i < num_masks; i++)
+		if (valuemask & masks[i].value)
+			if (first) {
+				first = False;
+				strcpy(buffer, masks[i].string);
+			} else {
+				strcat(buffer, " | ");
+				strcat(buffer, masks[i].string);
+			}
 
-    return (buffer);
+	return (buffer);
 }
 
 /* Returns the string equivalent of a motion hint */
 static char *IsHint(is_hint)
 char is_hint;
 {
-    switch (is_hint) {
-    case NotifyNormal:
-	return ("NotifyNormal");
+	switch (is_hint) {
+	case NotifyNormal:
+		return ("NotifyNormal");
 
-    case NotifyHint:
-	return ("NotifyHint");
+	case NotifyHint:
+		return ("NotifyHint");
 
-    default:
-	return ("?");
-    }
+	default:
+		return ("?");
+	}
 }
 
 /* Returns the string equivalent of an id or the value "None" */
 static char *MaybeNone(value)
 int value;
 {
-    static char buffer[16];
+	static char buffer[16];
 
-    if (value == None)
-	return ("None");
-    else {
-	sprintf(buffer, "0x%x", value);
-	return (buffer);
-    }
+	if (value == None)
+		return ("None");
+	else {
+		sprintf(buffer, "0x%x", value);
+		return (buffer);
+	}
 }
 
 /* Returns the string equivalent of a colormap state */
 static char *ColormapState(state)
 int state;
 {
-    switch (state) {
-    case ColormapInstalled:
-	return ("ColormapInstalled");
+	switch (state) {
+	case ColormapInstalled:
+		return ("ColormapInstalled");
 
-    case ColormapUninstalled:
-	return ("ColormapUninstalled");
+	case ColormapUninstalled:
+		return ("ColormapUninstalled");
 
-    default:
-	return ("?");
-    }
+	default:
+		return ("?");
+	}
 }
 
 /* Returns the string equivalent of a crossing detail */
 static char *CrossingDetail(detail)
 int detail;
 {
-    switch (detail) {
-    case NotifyAncestor:
-	return ("NotifyAncestor");
+	switch (detail) {
+	case NotifyAncestor:
+		return ("NotifyAncestor");
 
-    case NotifyInferior:
-	return ("NotifyInferior");
+	case NotifyInferior:
+		return ("NotifyInferior");
 
-    case NotifyVirtual:
-	return ("NotifyVirtual");
+	case NotifyVirtual:
+		return ("NotifyVirtual");
 
-    case NotifyNonlinear:
-	return ("NotifyNonlinear");
+	case NotifyNonlinear:
+		return ("NotifyNonlinear");
 
-    case NotifyNonlinearVirtual:
-	return ("NotifyNonlinearVirtual");
+	case NotifyNonlinearVirtual:
+		return ("NotifyNonlinearVirtual");
 
-    default:
-	return ("?");
-    }
+	default:
+		return ("?");
+	}
 }
 
 /* Returns the string equivalent of a focus change detail */
 static char *FocusChangeDetail(detail)
 int detail;
 {
-    switch (detail) {
-    case NotifyAncestor:
-	return ("NotifyAncestor");
+	switch (detail) {
+	case NotifyAncestor:
+		return ("NotifyAncestor");
 
-    case NotifyInferior:
-	return ("NotifyInferior");
+	case NotifyInferior:
+		return ("NotifyInferior");
 
-    case NotifyVirtual:
-	return ("NotifyVirtual");
+	case NotifyVirtual:
+		return ("NotifyVirtual");
 
-    case NotifyNonlinear:
-	return ("NotifyNonlinear");
+	case NotifyNonlinear:
+		return ("NotifyNonlinear");
 
-    case NotifyNonlinearVirtual:
-	return ("NotifyNonlinearVirtual");
+	case NotifyNonlinearVirtual:
+		return ("NotifyNonlinearVirtual");
 
-    case NotifyPointer:
-	return ("NotifyPointer");
+	case NotifyPointer:
+		return ("NotifyPointer");
 
-    case NotifyPointerRoot:
-	return ("NotifyPointerRoot");
+	case NotifyPointerRoot:
+		return ("NotifyPointerRoot");
 
-    case NotifyDetailNone:
-	return ("NotifyDetailNone");
+	case NotifyDetailNone:
+		return ("NotifyDetailNone");
 
-    default:
-	return ("?");
-    }
+	default:
+		return ("?");
+	}
 }
 
 /* Returns the string equivalent of a configure detail */
 static char *ConfigureDetail(detail)
 int detail;
 {
-    switch (detail) {
-    case Above:
-	return ("Above");
+	switch (detail) {
+	case Above:
+		return ("Above");
 
-    case Below:
-	return ("Below");
+	case Below:
+		return ("Below");
 
-    case TopIf:
-	return ("TopIf");
+	case TopIf:
+		return ("TopIf");
 
-    case BottomIf:
-	return ("BottomIf");
+	case BottomIf:
+		return ("BottomIf");
 
-    case Opposite:
-	return ("Opposite");
+	case Opposite:
+		return ("Opposite");
 
-    default:
-	return ("?");
-    }
+	default:
+		return ("?");
+	}
 }
 
 /* Returns the string equivalent of a grab mode */
 static char *GrabMode(mode)
 int mode;
 {
-    switch (mode) {
-    case NotifyNormal:
-	return ("NotifyNormal");
+	switch (mode) {
+	case NotifyNormal:
+		return ("NotifyNormal");
 
-    case NotifyGrab:
-	return ("NotifyGrab");
+	case NotifyGrab:
+		return ("NotifyGrab");
 
-    case NotifyUngrab:
-	return ("NotifyUngrab");
+	case NotifyUngrab:
+		return ("NotifyUngrab");
 
-    case NotifyWhileGrabbed:
-	return ("NotifyWhileGrabbed");
+	case NotifyWhileGrabbed:
+		return ("NotifyWhileGrabbed");
 
-    default:
-	return ("?");
-    }
+	default:
+		return ("?");
+	}
 }
 
 /* Returns the string equivalent of a mapping request */
 static char *MappingRequest(request)
 int request;
 {
-    switch (request) {
-    case MappingModifier:
-	return ("MappingModifier");
+	switch (request) {
+	case MappingModifier:
+		return ("MappingModifier");
 
-    case MappingKeyboard:
-	return ("MappingKeyboard");
+	case MappingKeyboard:
+		return ("MappingKeyboard");
 
-    case MappingPointer:
-	return ("MappingPointer");
+	case MappingPointer:
+		return ("MappingPointer");
 
-    default:
-	return ("?");
-    }
+	default:
+		return ("?");
+	}
 }
 
 /* Returns the string equivalent of a stacking order place */
 static char *Place(place)
 int place;
 {
-    switch (place) {
-    case PlaceOnTop:
-	return ("PlaceOnTop");
+	switch (place) {
+	case PlaceOnTop:
+		return ("PlaceOnTop");
 
-    case PlaceOnBottom:
-	return ("PlaceOnBottom");
+	case PlaceOnBottom:
+		return ("PlaceOnBottom");
 
-    default:
-	return ("?");
-    }
+	default:
+		return ("?");
+	}
 }
 
 /* Returns the string equivalent of a major code */
 static char *MajorCode(code)
 int code;
 {
-    static char buffer[32];
+	static char buffer[32];
 
-    switch (code) {
-    case X_CopyArea:
-	return ("X_CopyArea");
+	switch (code) {
+	case X_CopyArea:
+		return ("X_CopyArea");
 
-    case X_CopyPlane:
-	return ("X_CopyPlane");
+	case X_CopyPlane:
+		return ("X_CopyPlane");
 
-    default:
-	sprintf(buffer, "0x%x", code);
-	return (buffer);
-    }
+	default:
+		sprintf(buffer, "0x%x", code);
+		return (buffer);
+	}
 }
 
 /* Returns the string equivalent the keycode contained in the key event */
 static char *Keycode(ev)
 XKeyEvent *ev;
 {
-    static char buffer[256];
-    KeySym keysym_str;
-    char *keysym_name;
-    char string[256];
+	static char buffer[256];
+	KeySym keysym_str;
+	char *keysym_name;
+	char string[256];
 
-    XLookupString(ev, string, 64, &keysym_str, NULL);
+	XLookupString(ev, string, 64, &keysym_str, NULL);
 
-    if (keysym_str == NoSymbol)
-	keysym_name = "NoSymbol";
-    else if (!(keysym_name = XKeysymToString(keysym_str)))
-	keysym_name = "(no name)";
-    sprintf(buffer, "%u (keysym 0x%x \"%s\")",
-      ev->keycode, (unsigned)keysym_str, keysym_name);
-    return (buffer);
+	if (keysym_str == NoSymbol)
+		keysym_name = "NoSymbol";
+	else if (!(keysym_name = XKeysymToString(keysym_str)))
+		keysym_name = "(no name)";
+	sprintf(buffer, "%u (keysym 0x%x \"%s\")",
+	  ev->keycode, (unsigned)keysym_str, keysym_name);
+	return (buffer);
 }
 
 /* Returns the string equivalent of an atom or "None"*/
 static char *AtomName(Display *dpy, Atom atom)
 {
-    static char buffer[256];
-    char *atom_name;
+	static char buffer[256];
+	char *atom_name;
 
-    if (atom == None)
-	return ("None");
+	if (atom == None)
+		return ("None");
 
-    atom_name = XGetAtomName(dpy, atom);
-    strncpy(buffer, atom_name, 256);
-    XFree(atom_name);
-    return (buffer);
+	atom_name = XGetAtomName(dpy, atom);
+	strncpy(buffer, atom_name, 256);
+	XFree(atom_name);
+	return (buffer);
 }
 
 /******************************************************************************/
@@ -409,262 +409,262 @@
 
 static void VerbMotion(XMotionEvent *ev)
 {
-    printf("window=0x%x%s", (unsigned)ev->window, sep);
-    printf("root=0x%x%s", (unsigned)ev->root, sep);
-    printf("subwindow=0x%x%s", (unsigned)ev->subwindow, sep);
-    printf("time=%s%s", ServerTime(ev->time), sep);
-    printf("x=%d y=%d%s", ev->x, ev->y, sep);
-    printf("x_root=%d y_root=%d%s", ev->x_root, ev->y_root, sep);
-    printf("state=%s%s", ButtonAndOrModifierState(ev->state), sep);
-    printf("is_hint=%s%s", IsHint(ev->is_hint), sep);
-    printf("same_screen=%s\n", TorF(ev->same_screen));
+	printf("window=0x%x%s", (unsigned)ev->window, sep);
+	printf("root=0x%x%s", (unsigned)ev->root, sep);
+	printf("subwindow=0x%x%s", (unsigned)ev->subwindow, sep);
+	printf("time=%s%s", ServerTime(ev->time), sep);
+	printf("x=%d y=%d%s", ev->x, ev->y, sep);
+	printf("x_root=%d y_root=%d%s", ev->x_root, ev->y_root, sep);
+	printf("state=%s%s", ButtonAndOrModifierState(ev->state), sep);
+	printf("is_hint=%s%s", IsHint(ev->is_hint), sep);
+	printf("same_screen=%s\n", TorF(ev->same_screen));
 }
 
 static void VerbButton(XButtonEvent *ev)
 {
-    printf("window=0x%x%s", (unsigned)ev->window, sep);
-    printf("root=0x%x%s", (unsigned)ev->root, sep);
-    printf("subwindow=0x%x%s", (unsigned)ev->subwindow, sep);
-    printf("time=%s%s", ServerTime(ev->time), sep);
-    printf("x=%d y=%d%s", ev->x, ev->y, sep);
-    printf("x_root=%d y_root=%d%s", ev->x_root, ev->y_root, sep);
-    printf("state=%s%s", ButtonAndOrModifierState(ev->state), sep);
-    printf("button=%s%s", ButtonAndOrModifierState(ev->button), sep);
-    printf("same_screen=%s\n", TorF(ev->same_screen));
+	printf("window=0x%x%s", (unsigned)ev->window, sep);
+	printf("root=0x%x%s", (unsigned)ev->root, sep);
+	printf("subwindow=0x%x%s", (unsigned)ev->subwindow, sep);
+	printf("time=%s%s", ServerTime(ev->time), sep);
+	printf("x=%d y=%d%s", ev->x, ev->y, sep);
+	printf("x_root=%d y_root=%d%s", ev->x_root, ev->y_root, sep);
+	printf("state=%s%s", ButtonAndOrModifierState(ev->state), sep);
+	printf("button=%s%s", ButtonAndOrModifierState(ev->button), sep);
+	printf("same_screen=%s\n", TorF(ev->same_screen));
 }
 
 static void VerbColormap(XColormapEvent *ev)
 {
-    printf("window=0x%x%s", (unsigned)ev->window, sep);
-    printf("colormap=%s%s", MaybeNone(ev->colormap), sep);
-    printf("new=%s%s", TorF(ev->new), sep);
-    printf("state=%s\n", ColormapState(ev->state));
+	printf("window=0x%x%s", (unsigned)ev->window, sep);
+	printf("colormap=%s%s", MaybeNone(ev->colormap), sep);
+	printf("new=%s%s", TorF(ev->new), sep);
+	printf("state=%s\n", ColormapState(ev->state));
 }
 
 static void VerbCrossing(XCrossingEvent *ev)
 {
-    printf("window=0x%x%s", (unsigned)ev->window, sep);
-    printf("root=0x%x%s", (unsigned)ev->root, sep);
-    printf("subwindow=0x%x%s", (unsigned)ev->subwindow, sep);
-    printf("time=%s%s", ServerTime(ev->time), sep);
-    printf("x=%d y=%d%s", ev->x, ev->y, sep);
-    printf("x_root=%d y_root=%d%s", ev->x_root, ev->y_root, sep);
-    printf("mode=%s%s", GrabMode(ev->mode), sep);
-    printf("detail=%s%s", CrossingDetail(ev->detail), sep);
-    printf("same_screen=%s%s", TorF(ev->same_screen), sep);
-    printf("focus=%s%s", TorF(ev->focus), sep);
-    printf("state=%s\n", ButtonAndOrModifierState(ev->state));
+	printf("window=0x%x%s", (unsigned)ev->window, sep);
+	printf("root=0x%x%s", (unsigned)ev->root, sep);
+	printf("subwindow=0x%x%s", (unsigned)ev->subwindow, sep);
+	printf("time=%s%s", ServerTime(ev->time), sep);
+	printf("x=%d y=%d%s", ev->x, ev->y, sep);
+	printf("x_root=%d y_root=%d%s", ev->x_root, ev->y_root, sep);
+	printf("mode=%s%s", GrabMode(ev->mode), sep);
+	printf("detail=%s%s", CrossingDetail(ev->detail), sep);
+	printf("same_screen=%s%s", TorF(ev->same_screen), sep);
+	printf("focus=%s%s", TorF(ev->focus), sep);
+	printf("state=%s\n", ButtonAndOrModifierState(ev->state));
 }
 
 static void VerbExpose(XExposeEvent *ev)
 {
-    printf("window=0x%x%s", (unsigned)ev->window, sep);
-    printf("x=%d y=%d%s", ev->x, ev->y, sep);
-    printf("width=%d height=%d%s", ev->width, ev->height, sep);
-    printf("count=%d\n", ev->count);
+	printf("window=0x%x%s", (unsigned)ev->window, sep);
+	printf("x=%d y=%d%s", ev->x, ev->y, sep);
+	printf("width=%d height=%d%s", ev->width, ev->height, sep);
+	printf("count=%d\n", ev->count);
 }
 
 static void VerbGraphicsExpose(XGraphicsExposeEvent *ev)
 {
-    printf("drawable=0x%x%s", (unsigned)ev->drawable, sep);
-    printf("x=%d y=%d%s", ev->x, ev->y, sep);
-    printf("width=%d height=%d%s", ev->width, ev->height, sep);
-    printf("major_code=%s%s", MajorCode(ev->major_code), sep);
-    printf("minor_code=%d\n", ev->minor_code);
+	printf("drawable=0x%x%s", (unsigned)ev->drawable, sep);
+	printf("x=%d y=%d%s", ev->x, ev->y, sep);
+	printf("width=%d height=%d%s", ev->width, ev->height, sep);
+	printf("major_code=%s%s", MajorCode(ev->major_code), sep);
+	printf("minor_code=%d\n", ev->minor_code);
 }
 
 static void VerbNoExpose(XNoExposeEvent *ev)
 {
-    printf("drawable=0x%x%s", (unsigned)ev->drawable, sep);
-    printf("major_code=%s%s", MajorCode(ev->major_code), sep);
-    printf("minor_code=%d\n", ev->minor_code);
+	printf("drawable=0x%x%s", (unsigned)ev->drawable, sep);
+	printf("major_code=%s%s", MajorCode(ev->major_code), sep);
+	printf("minor_code=%d\n", ev->minor_code);
 }
 
 static void VerbFocus(XFocusChangeEvent *ev)
 {
-    printf("window=0x%x%s", (unsigned)ev->window, sep);
-    printf("mode=%s%s", GrabMode(ev->mode), sep);
-    printf("detail=%s\n", FocusChangeDetail(ev->detail));
+	printf("window=0x%x%s", (unsigned)ev->window, sep);
+	printf("mode=%s%s", GrabMode(ev->mode), sep);
+	printf("detail=%s\n", FocusChangeDetail(ev->detail));
 }
 
 static void VerbKeymap(XKeymapEvent *ev)
 {
-    int i;
+	int i;
 
-    printf("window=0x%x%s", (unsigned)ev->window, sep);
-    printf("key_vector=");
-    for (i = 0; i < 32; i++)
-	printf("%02x", ev->key_vector[i]);
-    printf("\n");
+	printf("window=0x%x%s", (unsigned)ev->window, sep);
+	printf("key_vector=");
+	for (i = 0; i < 32; i++)
+		printf("%02x", ev->key_vector[i]);
+	printf("\n");
 }
 
 static void VerbKey(XKeyEvent *ev)
 {
-    printf("window=0x%x%s", (unsigned)ev->window, sep);
-    printf("root=0x%x%s", (unsigned)ev->root, sep);
-    printf("subwindow=0x%x%s", (unsigned)ev->subwindow, sep);
-    printf("time=%s%s", ServerTime(ev->time), sep);
-    printf("x=%d y=%d%s", ev->x, ev->y, sep);
-    printf("x_root=%d y_root=%d%s", ev->x_root, ev->y_root, sep);
-    printf("state=%s%s", ButtonAndOrModifierState(ev->state), sep);
-    printf("keycode=%s%s", Keycode(ev), sep);
-    printf("same_screen=%s\n", TorF(ev->same_screen));
+	printf("window=0x%x%s", (unsigned)ev->window, sep);
+	printf("root=0x%x%s", (unsigned)ev->root, sep);
+	printf("subwindow=0x%x%s", (unsigned)ev->subwindow, sep);
+	printf("time=%s%s", ServerTime(ev->time), sep);
+	printf("x=%d y=%d%s", ev->x, ev->y, sep);
+	printf("x_root=%d y_root=%d%s", ev->x_root, ev->y_root, sep);
+	printf("state=%s%s", ButtonAndOrModifierState(ev->state), sep);
+	printf("keycode=%s%s", Keycode(ev), sep);
+	printf("same_screen=%s\n", TorF(ev->same_screen));
 }
 
 static void VerbProperty(XPropertyEvent *ev)
 {
-    printf("window=0x%x%s", (unsigned)ev->window, sep);
-    printf("atom=%s%s", AtomName(ev->display, ev->atom), sep);
-    printf("time=%s%s", ServerTime(ev->time), sep);
-    printf("state=%s\n", PropertyState(ev->state));
+	printf("window=0x%x%s", (unsigned)ev->window, sep);
+	printf("atom=%s%s", AtomName(ev->display, ev->atom), sep);
+	printf("time=%s%s", ServerTime(ev->time), sep);
+	printf("state=%s\n", PropertyState(ev->state));
 }
 
 static void VerbResizeRequest(XResizeRequestEvent *ev)
 {
-    printf("window=0x%x%s", (unsigned)ev->window, sep);
-    printf("width=%d height=%d\n", ev->width, ev->height);
+	printf("window=0x%x%s", (unsigned)ev->window, sep);
+	printf("width=%d height=%d\n", ev->width, ev->height);
 }
 
 static void VerbCirculate(XCirculateEvent *ev)
 {
-    printf("event=0x%x%s", (unsigned)ev->event, sep);
-    printf("window=0x%x%s", (unsigned)ev->window, sep);
-    printf("place=%s\n", Place(ev->place));
+	printf("event=0x%x%s", (unsigned)ev->event, sep);
+	printf("window=0x%x%s", (unsigned)ev->window, sep);
+	printf("place=%s\n", Place(ev->place));
 }
 
 static void VerbConfigure(XConfigureEvent *ev)
 {
-    printf("event=0x%x%s", (unsigned)ev->event, sep);
-    printf("window=0x%x%s", (unsigned)ev->window, sep);
-    printf("x=%d y=%d%s", ev->x, ev->y, sep);
-    printf("width=%d height=%d%s", ev->width, ev->height, sep);
-    printf("border_width=%d%s", ev->border_width, sep);
-    printf("above=%s%s", MaybeNone(ev->above), sep);
-    printf("override_redirect=%s\n", TorF(ev->override_redirect));
+	printf("event=0x%x%s", (unsigned)ev->event, sep);
+	printf("window=0x%x%s", (unsigned)ev->window, sep);
+	printf("x=%d y=%d%s", ev->x, ev->y, sep);
+	printf("width=%d height=%d%s", ev->width, ev->height, sep);
+	printf("border_width=%d%s", ev->border_width, sep);
+	printf("above=%s%s", MaybeNone(ev->above), sep);
+	printf("override_redirect=%s\n", TorF(ev->override_redirect));
 }
 
 static void VerbCreateWindow(XCreateWindowEvent *ev)
 {
-    printf("parent=0x%x%s", (unsigned)ev->parent, sep);
-    printf("window=0x%x%s", (unsigned)ev->window, sep);
-    printf("x=%d y=%d%s", ev->x, ev->y, sep);
-    printf("width=%d height=%d%s", ev->width, ev->height, sep);
-    printf("border_width=%d%s", ev->border_width, sep);
-    printf("override_redirect=%s\n", TorF(ev->override_redirect));
+	printf("parent=0x%x%s", (unsigned)ev->parent, sep);
+	printf("window=0x%x%s", (unsigned)ev->window, sep);
+	printf("x=%d y=%d%s", ev->x, ev->y, sep);
+	printf("width=%d height=%d%s", ev->width, ev->height, sep);
+	printf("border_width=%d%s", ev->border_width, sep);
+	printf("override_redirect=%s\n", TorF(ev->override_redirect));
 }
 
 static void VerbDestroyWindow(XDestroyWindowEvent *ev)
 {
-    printf("event=0x%x%s", (unsigned)ev->event, sep);
-    printf("window=0x%x\n", (unsigned)ev->window);
+	printf("event=0x%x%s", (unsigned)ev->event, sep);
+	printf("window=0x%x\n", (unsigned)ev->window);
 }
 
 static void VerbGravity(XGravityEvent *ev)
 {
-    printf("event=0x%x%s", (unsigned)ev->event, sep);
-    printf("window=0x%x%s", (unsigned)ev->window, sep);
-    printf("x=%d y=%d\n", ev->x, ev->y);
+	printf("event=0x%x%s", (unsigned)ev->event, sep);
+	printf("window=0x%x%s", (unsigned)ev->window, sep);
+	printf("x=%d y=%d\n", ev->x, ev->y);
 }
 
 static void VerbMap(XMapEvent *ev)
 {
-    printf("event=0x%x%s", (unsigned)ev->event, sep);
-    printf("window=0x%x%s", (unsigned)ev->window, sep);
-    printf("override_redirect=%s\n", TorF(ev->override_redirect));
+	printf("event=0x%x%s", (unsigned)ev->event, sep);
+	printf("window=0x%x%s", (unsigned)ev->window, sep);
+	printf("override_redirect=%s\n", TorF(ev->override_redirect));
 }
 
 static void VerbReparent(XReparentEvent *ev)
 {
-    printf("event=0x%x%s", (unsigned)ev->event, sep);
-    printf("window=0x%x%s", (unsigned)ev->window, sep);
-    printf("parent=0x%x%s", (unsigned)ev->parent, sep);
-    printf("x=%d y=%d%s", ev->x, ev->y, sep);
-    printf("override_redirect=%s\n", TorF(ev->override_redirect));
+	printf("event=0x%x%s", (unsigned)ev->event, sep);
+	printf("window=0x%x%s", (unsigned)ev->window, sep);
+	printf("parent=0x%x%s", (unsigned)ev->parent, sep);
+	printf("x=%d y=%d%s", ev->x, ev->y, sep);
+	printf("override_redirect=%s\n", TorF(ev->override_redirect));
 }
 
 static void VerbUnmap(XUnmapEvent *ev)
 {
-    printf("event=0x%x%s", (unsigned)ev->event, sep);
-    printf("window=0x%x%s", (unsigned)ev->window, sep);
-    printf("from_configure=%s\n", TorF(ev->from_configure));
+	printf("event=0x%x%s", (unsigned)ev->event, sep);
+	printf("window=0x%x%s", (unsigned)ev->window, sep);
+	printf("from_configure=%s\n", TorF(ev->from_configure));
 }
 
 static void VerbCirculateRequest(XCirculateRequestEvent *ev)
 {
-    printf("parent=0x%x%s", (unsigned)ev->parent, sep);
-    printf("window=0x%x%s", (unsigned)ev->window, sep);
-    printf("place=%s\n", Place(ev->place));
+	printf("parent=0x%x%s", (unsigned)ev->parent, sep);
+	printf("window=0x%x%s", (unsigned)ev->window, sep);
+	printf("place=%s\n", Place(ev->place));
 }
 
 static void VerbConfigureRequest(XConfigureRequestEvent *ev)
 {
-    printf("parent=0x%x%s", (unsigned)ev->parent, sep);
-    printf("window=0x%x%s", (unsigned)ev->window, sep);
-    printf("x=%d y=%d%s", ev->x, ev->y, sep);
-    printf("width=%d height=%d%s", ev->width, ev->height, sep);
-    printf("border_width=%d%s", ev->border_width, sep);
-    printf("above=%s%s", MaybeNone(ev->above), sep);
-    printf("detail=%s%s", ConfigureDetail(ev->detail), sep);
-    printf("value_mask=%s\n", ConfigureValueMask(ev->value_mask));
+	printf("parent=0x%x%s", (unsigned)ev->parent, sep);
+	printf("window=0x%x%s", (unsigned)ev->window, sep);
+	printf("x=%d y=%d%s", ev->x, ev->y, sep);
+	printf("width=%d height=%d%s", ev->width, ev->height, sep);
+	printf("border_width=%d%s", ev->border_width, sep);
+	printf("above=%s%s", MaybeNone(ev->above), sep);
+	printf("detail=%s%s", ConfigureDetail(ev->detail), sep);
+	printf("value_mask=%s\n", ConfigureValueMask(ev->value_mask));
 }
 
 static void VerbMapRequest(XMapRequestEvent *ev)
 {
-    printf("parent=0x%x%s", (unsigned)ev->parent, sep);
-    printf("window=0x%x\n", (unsigned)ev->window);
+	printf("parent=0x%x%s", (unsigned)ev->parent, sep);
+	printf("window=0x%x\n", (unsigned)ev->window);
 }
 
 static void VerbClient(XClientMessageEvent *ev)
 {
-    int i;
+	int i;
 
-    printf("window=0x%x%s", (unsigned)ev->window, sep);
-    printf("message_type=%s%s", AtomName(ev->display, ev->message_type), sep);
-    printf("format=%d\n", ev->format);
-    printf("data (shown as longs)=");
-    for (i = 0; i < 5; i++)
-	printf(" 0x%08lx", ev->data.l[i]);
-    printf("\n");
+	printf("window=0x%x%s", (unsigned)ev->window, sep);
+	printf("message_type=%s%s", AtomName(ev->display, ev->message_type), sep);
+	printf("format=%d\n", ev->format);
+	printf("data (shown as longs)=");
+	for (i = 0; i < 5; i++)
+		printf(" 0x%08lx", ev->data.l[i]);
+	printf("\n");
 }
 
 static void VerbMapping(XMappingEvent *ev)
 {
-    printf("window=0x%x%s", (unsigned)ev->window, sep);
-    printf("request=%s%s", MappingRequest(ev->request), sep);
-    printf("first_keycode=0x%x%s", ev->first_keycode, sep);
-    printf("count=0x%x\n", ev->count);
+	printf("window=0x%x%s", (unsigned)ev->window, sep);
+	printf("request=%s%s", MappingRequest(ev->request), sep);
+	printf("first_keycode=0x%x%s", ev->first_keycode, sep);
+	printf("count=0x%x\n", ev->count);
 }
 
 static void VerbSelectionClear(XSelectionClearEvent *ev)
 {
-    printf("window=0x%x%s", (unsigned)ev->window, sep);
-    printf("selection=%s%s", AtomName(ev->display, ev->selection), sep);
-    printf("time=%s\n", ServerTime(ev->time));
+	printf("window=0x%x%s", (unsigned)ev->window, sep);
+	printf("selection=%s%s", AtomName(ev->display, ev->selection), sep);
+	printf("time=%s\n", ServerTime(ev->time));
 }
 
 static void VerbSelection(XSelectionEvent *ev)
 {
-    printf("requestor=0x%x%s", (unsigned)ev->requestor, sep);
-    printf("selection=%s%s", AtomName(ev->display, ev->selection), sep);
-    printf("target=%s%s", AtomName(ev->display, ev->target), sep);
-    printf("property=%s%s", AtomName(ev->display, ev->property), sep);
-    printf("time=%s\n", ServerTime(ev->time));
+	printf("requestor=0x%x%s", (unsigned)ev->requestor, sep);
+	printf("selection=%s%s", AtomName(ev->display, ev->selection), sep);
+	printf("target=%s%s", AtomName(ev->display, ev->target), sep);
+	printf("property=%s%s", AtomName(ev->display, ev->property), sep);
+	printf("time=%s\n", ServerTime(ev->time));
 }
 
 static void VerbSelectionRequest(XSelectionRequestEvent *ev)
 {
-    printf("owner=0x%x%s", (unsigned)ev->owner, sep);
-    printf("requestor=0x%x%s", (unsigned)ev->requestor, sep);
-    printf("selection=%s%s", AtomName(ev->display, ev->selection), sep);
-    printf("target=%s%s", AtomName(ev->display, ev->target), sep);
-    printf("property=%s%s", AtomName(ev->display, ev->property), sep);
-    printf("time=%s\n", ServerTime(ev->time));
+	printf("owner=0x%x%s", (unsigned)ev->owner, sep);
+	printf("requestor=0x%x%s", (unsigned)ev->requestor, sep);
+	printf("selection=%s%s", AtomName(ev->display, ev->selection), sep);
+	printf("target=%s%s", AtomName(ev->display, ev->target), sep);
+	printf("property=%s%s", AtomName(ev->display, ev->property), sep);
+	printf("time=%s\n", ServerTime(ev->time));
 }
 
 static void VerbVisibility(XVisibilityEvent *ev)
 {
-    printf("window=0x%x%s", (unsigned)ev->window, sep);
-    printf("state=%s\n", VisibilityState(ev->state));
+	printf("window=0x%x%s", (unsigned)ev->window, sep);
+	printf("state=%s\n", VisibilityState(ev->state));
 }
 
 /******************************************************************************/
@@ -674,75 +674,75 @@
 char *GetType(ev)
 XEvent *ev;
 {
-    switch (ev->type) {
-    case KeyPress:
-	return ("KeyPress");
-    case KeyRelease:
-	return ("KeyRelease");
-    case ButtonPress:
-	return ("ButtonPress");
-    case ButtonRelease:
-	return ("ButtonRelease");
-    case MotionNotify:
-	return ("MotionNotify");
-    case EnterNotify:
-	return ("EnterNotify");
-    case LeaveNotify:
-	return ("LeaveNotify");
-    case FocusIn:
-	return ("FocusIn");
-    case FocusOut:
-	return ("FocusOut");
-    case KeymapNotify:
-	return ("KeymapNotify");
-    case Expose:
-	return ("Expose");
-    case GraphicsExpose:
-	return ("GraphicsExpose");
-    case NoExpose:
-	return ("NoExpose");
-    case VisibilityNotify:
-	return ("VisibilityNotify");
-    case CreateNotify:
-	return ("CreateNotify");
-    case DestroyNotify:
-	return ("DestroyNotify");
-    case UnmapNotify:
-	return ("UnmapNotify");
-    case MapNotify:
-	return ("MapNotify");
-    case MapRequest:
-	return ("MapRequest");
-    case ReparentNotify:
-	return ("ReparentNotify");
-    case ConfigureNotify:
-	return ("ConfigureNotify");
-    case ConfigureRequest:
-	return ("ConfigureRequest");
-    case GravityNotify:
-	return ("GravityNotify");
-    case ResizeRequest:
-	return ("ResizeRequest");
-    case CirculateNotify:
-	return ("CirculateNotify");
-    case CirculateRequest:
-	return ("CirculateRequest");
-    case PropertyNotify:
-	return ("PropertyNotify");
-    case SelectionClear:
-	return ("SelectionClear");
-    case SelectionRequest:
-	return ("SelectionRequest");
-    case SelectionNotify:
-	return ("SelectionNotify");
-    case ColormapNotify:
-	return ("ColormapNotify");
-    case ClientMessage:
-	return ("ClientMessage");
-    case MappingNotify:
-	return ("MappingNotify");
-    }
-    return "???";
+	switch (ev->type) {
+	case KeyPress:
+		return ("KeyPress");
+	case KeyRelease:
+		return ("KeyRelease");
+	case ButtonPress:
+		return ("ButtonPress");
+	case ButtonRelease:
+		return ("ButtonRelease");
+	case MotionNotify:
+		return ("MotionNotify");
+	case EnterNotify:
+		return ("EnterNotify");
+	case LeaveNotify:
+		return ("LeaveNotify");
+	case FocusIn:
+		return ("FocusIn");
+	case FocusOut:
+		return ("FocusOut");
+	case KeymapNotify:
+		return ("KeymapNotify");
+	case Expose:
+		return ("Expose");
+	case GraphicsExpose:
+		return ("GraphicsExpose");
+	case NoExpose:
+		return ("NoExpose");
+	case VisibilityNotify:
+		return ("VisibilityNotify");
+	case CreateNotify:
+		return ("CreateNotify");
+	case DestroyNotify:
+		return ("DestroyNotify");
+	case UnmapNotify:
+		return ("UnmapNotify");
+	case MapNotify:
+		return ("MapNotify");
+	case MapRequest:
+		return ("MapRequest");
+	case ReparentNotify:
+		return ("ReparentNotify");
+	case ConfigureNotify:
+		return ("ConfigureNotify");
+	case ConfigureRequest:
+		return ("ConfigureRequest");
+	case GravityNotify:
+		return ("GravityNotify");
+	case ResizeRequest:
+		return ("ResizeRequest");
+	case CirculateNotify:
+		return ("CirculateNotify");
+	case CirculateRequest:
+		return ("CirculateRequest");
+	case PropertyNotify:
+		return ("PropertyNotify");
+	case SelectionClear:
+		return ("SelectionClear");
+	case SelectionRequest:
+		return ("SelectionRequest");
+	case SelectionNotify:
+		return ("SelectionNotify");
+	case ColormapNotify:
+		return ("ColormapNotify");
+	case ClientMessage:
+		return ("ClientMessage");
+	case MappingNotify:
+		return ("MappingNotify");
+	}
+	return "???";
 }
 
 /******************************************************************************/
@@ -751,138 +751,138 @@
 
 void ShowEvent(XEvent *eev)
 {
-    XAnyEvent *ev = (XAnyEvent*)eev;
-    /* determine which field separator to use */
-    if (use_separate_lines)
-	sep = "\n";
-    else
-	sep = " ";
+	XAnyEvent *ev = (XAnyEvent*)eev;
+	/* determine which field separator to use */
+	if (use_separate_lines)
+		sep = "\n";
+	else
+		sep = " ";
 
-    printf("type=%s%s", GetType(ev), sep);
-    printf("serial=%ld%s", ev->serial, sep);
-    printf("send_event=%s%s", TorF(ev->send_event), sep);
-    printf("display=0x%x%s", (unsigned)ev->display, sep);
+	printf("type=%s%s", GetType((XEvent*)ev), sep);
+	printf("serial=%ld%s", ev->serial, sep);
+	printf("send_event=%s%s", TorF(ev->send_event), sep);
+	printf("display=0x%x%s", (unsigned)ev->display, sep);
 
-    switch (ev->type) {
-    case MotionNotify:
-	VerbMotion((void*)ev);
-	break;
+	switch (ev->type) {
+	case MotionNotify:
+		VerbMotion((void*)ev);
+		break;
 
-    case ButtonPress:
-    case ButtonRelease:
-	VerbButton((void*)ev);
-	break;
+	case ButtonPress:
+	case ButtonRelease:
+		VerbButton((void*)ev);
+		break;
 
-    case ColormapNotify:
-	VerbColormap((void*)ev);
-	break;
+	case ColormapNotify:
+		VerbColormap((void*)ev);
+		break;
 
-    case EnterNotify:
-    case LeaveNotify:
-	VerbCrossing((void*)ev);
-	break;
+	case EnterNotify:
+	case LeaveNotify:
+		VerbCrossing((void*)ev);
+		break;
 
-    case Expose:
-	VerbExpose((void*)ev);
-	break;
+	case Expose:
+		VerbExpose((void*)ev);
+		break;
 
-    case GraphicsExpose:
-	VerbGraphicsExpose((void*)ev);
-	break;
+	case GraphicsExpose:
+		VerbGraphicsExpose((void*)ev);
+		break;
 
-    case NoExpose:
-	VerbNoExpose((void*)ev);
-	break;
+	case NoExpose:
+		VerbNoExpose((void*)ev);
+		break;
 
-    case FocusIn:
-    case FocusOut:
-	VerbFocus((void*)ev);
-	break;
+	case FocusIn:
+	case FocusOut:
+		VerbFocus((void*)ev);
+		break;
 
-    case KeymapNotify:
-	VerbKeymap((void*)ev);
-	break;
+	case KeymapNotify:
+		VerbKeymap((void*)ev);
+		break;
 
-    case KeyPress:
-    case KeyRelease:
-	VerbKey((void*)ev);
-	break;
+	case KeyPress:
+	case KeyRelease:
+		VerbKey((void*)ev);
+		break;
 
-    case PropertyNotify:
-	VerbProperty((void*)ev);
-	break;
+	case PropertyNotify:
+		VerbProperty((void*)ev);
+		break;
 
-    case ResizeRequest:
-	VerbResizeRequest((void*)ev);
-	break;
+	case ResizeRequest:
+		VerbResizeRequest((void*)ev);
+		break;
 
-    case CirculateNotify:
-	VerbCirculate((void*)ev);
-	break;
+	case CirculateNotify:
+		VerbCirculate((void*)ev);
+		break;
 
-    case ConfigureNotify:
-	VerbConfigure((void*)ev);
-	break;
+	case ConfigureNotify:
+		VerbConfigure((void*)ev);
+		break;
 
-    case CreateNotify:
-	VerbCreateWindow((void*)ev);
-	break;
+	case CreateNotify:
+		VerbCreateWindow((void*)ev);
+		break;
 
-    case DestroyNotify:
-	VerbDestroyWindow((void*)ev);
-	break;
+	case DestroyNotify:
+		VerbDestroyWindow((void*)ev);
+		break;
 
-    case GravityNotify:
-	VerbGravity((void*)ev);
-	break;
+	case GravityNotify:
+		VerbGravity((void*)ev);
+		break;
 
-    case MapNotify:
-	VerbMap((void*)ev);
-	break;
+	case MapNotify:
+		VerbMap((void*)ev);
+		break;
 
-    case ReparentNotify:
-	VerbReparent((void*)ev);
-	break;
+	case ReparentNotify:
+		VerbReparent((void*)ev);
+		break;
 
-    case UnmapNotify:
-	VerbUnmap((void*)ev);
-	break;
+	case UnmapNotify:
+		VerbUnmap((void*)ev);
+		break;
 
-    case CirculateRequest:
-	VerbCirculateRequest((void*)ev);
-	break;
+	case CirculateRequest:
+		VerbCirculateRequest((void*)ev);
+		break;
 
-    case ConfigureRequest:
-	VerbConfigureRequest((void*)ev);
-	break;
+	case ConfigureRequest:
+		VerbConfigureRequest((void*)ev);
+		break;
 
-    case MapRequest:
-	VerbMapRequest((void*)ev);
-	break;
+	case MapRequest:
+		VerbMapRequest((void*)ev);
+		break;
 
-    case ClientMessage:
-	VerbClient((void*)ev);
-	break;
+	case ClientMessage:
+		VerbClient((void*)ev);
+		break;
 
-    case MappingNotify:
-	VerbMapping((void*)ev);
-	break;
+	case MappingNotify:
+		VerbMapping((void*)ev);
+		break;
 
-    case SelectionClear:
-	VerbSelectionClear((void*)ev);
-	break;
+	case SelectionClear:
+		VerbSelectionClear((void*)ev);
+		break;
 
-    case SelectionNotify:
-	VerbSelection((void*)ev);
-	break;
+	case SelectionNotify:
+		VerbSelection((void*)ev);
+		break;
 
-    case SelectionRequest:
-	VerbSelectionRequest((void*)ev);
-	break;
+	case SelectionRequest:
+		VerbSelectionRequest((void*)ev);
+		break;
 
-    case VisibilityNotify:
-	VerbVisibility((void*)ev);
-	break;
+	case VisibilityNotify:
+		VerbVisibility((void*)ev);
+		break;
 
-    }
+	}
 }
diff --git a/src/cmd/sam/file.c b/src/cmd/sam/file.c
index 07d73bb..c8b8d65 100644
--- a/src/cmd/sam/file.c
+++ b/src/cmd/sam/file.c
@@ -130,7 +130,7 @@
 		return;
 	if(ns == 0)
 		return;
-	if(ns<0 || ns>STRSIZE)
+	if(ns>STRSIZE)
 		panic("loginsert");
 	if(f->seq < seq)
 		filemark(f);
diff --git a/src/cmd/vac/vac.c b/src/cmd/vac/vac.c
index 03ada7b..b54503e 100644
--- a/src/cmd/vac/vac.c
+++ b/src/cmd/vac/vac.c
@@ -511,7 +511,6 @@
 		/* don't write anything */
 	}
 	else if(d->mode&DMSYMLINK){
-		memset(buf, 0, sizeof buf);
 		n = readlink(name, buf, sizeof buf);
 		if(n > 0 && vacfilewrite(f, buf, n, 0) < 0){
 			warn("venti write %s: %r", name);
diff --git a/src/cmd/venti/srv/fixarenas.c b/src/cmd/venti/srv/fixarenas.c
index ac05ab8..d7ae41d 100644
--- a/src/cmd/venti/srv/fixarenas.c
+++ b/src/cmd/venti/srv/fixarenas.c
@@ -130,12 +130,12 @@
 	int i, j, k, n;
 
 	if(offset >= partend){
-		memset(buf, 0xFB, sizeof buf);
+		memset(buf, 0xFB, len);
 		return buf;
 	}
 	
 	if(offset+len > partend){
-		memset(buf, 0xFB, sizeof buf);
+		memset(buf, 0xFB, len);
 		len = partend - offset;
 	}
 
diff --git a/src/cmd/venti/srv/lumpcache.c b/src/cmd/venti/srv/lumpcache.c
index d9a6b95..93fed6d 100644
--- a/src/cmd/venti/srv/lumpcache.c
+++ b/src/cmd/venti/srv/lumpcache.c
@@ -413,7 +413,7 @@
 	}
 	if(lumpcache.avail != lumpcache.allowed - size){
 		fprint(2, "mismatched available=%d and allowed=%d - used=%d space", lumpcache.avail, lumpcache.allowed, size);
-		*(int*)0=0;
+		*(volatile int*)0=0;
 	}
 
 	nfree = 0;
diff --git a/src/lib9/zoneinfo.c b/src/lib9/zoneinfo.c
index f49d812..91f1885 100644
--- a/src/lib9/zoneinfo.c
+++ b/src/lib9/zoneinfo.c
@@ -36,7 +36,7 @@
 	fd = open(file, OREAD);
 	if (fd<0)
 		return nil;
-        d = dirfstat(fd);
+	d = dirfstat(fd);
 	if (d==nil)
 		return nil;
 	p = malloc(d->length);
@@ -118,21 +118,19 @@
 	char *tmp;
 
 	z.timecnt = 0;
-	switch (zonefile==nil) {
-	default:
+	if(zonefile==nil) {
 		if ((tmp=getenv("timezone"))!=nil) {
 			tzdata = readtzfile(tmp);
 			free(tmp);
-			break;
+			goto havedata;
 		}
 		zonefile = "/etc/localtime";
-		/* fall through */
-	case 0:
-		tzdata = readtzfile(zonefile);
 	}
+	tzdata = readtzfile(zonefile);
 	if (tzdata==nil)
 		return;
 
+havedata:
 	if (strncmp("TZif", (char*)tzdata, 4)!=0)
 		goto errfree;
 
diff --git a/src/lib9p/srv.c b/src/lib9p/srv.c
index a857375..d12e352 100644
--- a/src/lib9p/srv.c
+++ b/src/lib9p/srv.c
@@ -471,7 +471,7 @@
 		respond(r, Eunknownfid);
 		return;
 	}
-	if(r->ifcall.count < 0){
+	if((int32)r->ifcall.count < 0){
 		respond(r, Ebotch);
 		return;
 	}
@@ -518,7 +518,7 @@
 		respond(r, Eunknownfid);
 		return;
 	}
-	if(r->ifcall.count < 0){
+	if((int32)r->ifcall.count < 0){
 		respond(r, Ebotch);
 		return;
 	}
diff --git a/src/libdiskfs/venti.c b/src/libdiskfs/venti.c
index e3e4420..a497d5e 100644
--- a/src/libdiskfs/venti.c
+++ b/src/libdiskfs/venti.c
@@ -30,7 +30,6 @@
 	memset(index, 0, VtPointerDepth*sizeof(int));
 
 	np = e->psize/VtScoreSize;
-	memset(index, 0, sizeof(index));
 	for(i=0; bn > 0; i++){
 		if(i >= VtPointerDepth){
 			werrstr("bad block number %lud", (ulong)bn);
diff --git a/src/libmach/symstabs.c b/src/libmach/symstabs.c
index a8c2af7..77c6bab 100644
--- a/src/libmach/symstabs.c
+++ b/src/libmach/symstabs.c
@@ -230,7 +230,7 @@
 							fun->u.stabs.framesize = sym.value - 4;
 						}
 					}else if(sym.type == N_LSYM){
-						if(sym.value >= 0){
+						if((int32)sym.value >= 0){
 							fun->u.stabs.frameptr = 0;
 							if(params)
 								fun->u.stabs.framesize = 8 - 4;
diff --git a/src/libsec/port/tlshand.c b/src/libsec/port/tlshand.c
index e01f685..ae21671 100644
--- a/src/libsec/port/tlshand.c
+++ b/src/libsec/port/tlshand.c
@@ -1401,7 +1401,7 @@
 	tlsSecClose(c->sec);
 	freebytes(c->sid);
 	freebytes(c->cert);
-	memset(c, 0, sizeof(c));
+	memset(c, 0, sizeof(*c));
 	free(c);
 }
 
diff --git a/src/libsunrpc/fmt.c b/src/libsunrpc/fmt.c
index 492497d..a210c67 100644
--- a/src/libsunrpc/fmt.c
+++ b/src/libsunrpc/fmt.c
@@ -52,7 +52,7 @@
 		p = fmtProg[i];
 		if(p->prog == c->rpc.prog && p->vers == c->rpc.vers){
 			runlock(&fmtLock);
-			if(c->type < 0 || c->type >= p->nproc || (fmt=p->proc[c->type].fmt) == nil)
+			if((int32)c->type < 0 || c->type >= p->nproc || (fmt=p->proc[c->type].fmt) == nil)
 				return fmtprint(f, "unknown proc %c%d", "TR"[c->type&1], c->type>>1);
 			(*fmt)(f, c);
 			return 0;
diff --git a/src/libsunrpc/mount3.c b/src/libsunrpc/mount3.c
index 3729b22..d487c80 100644
--- a/src/libsunrpc/mount3.c
+++ b/src/libsunrpc/mount3.c
@@ -131,7 +131,6 @@
 		a = a + 4 + 4 * x->nauth;
 		break;
 	}
-	a = a;
 	return a;
 }
 uint
diff --git a/src/libsunrpc/prog.c b/src/libsunrpc/prog.c
index 5258e3e..aa5d0fd 100644
--- a/src/libsunrpc/prog.c
+++ b/src/libsunrpc/prog.c
@@ -11,7 +11,7 @@
 
 	if(pa == nil)
 		pa = &x;
-	if(c->type < 0 || c->type >= prog->nproc || (pack=prog->proc[c->type].pack) == nil)
+	if((int32)c->type < 0 || c->type >= prog->nproc || (pack=prog->proc[c->type].pack) == nil)
 		return SunProcUnavail;
 	if((*pack)(a, ea, pa, c) < 0)
 		return SunGarbageArgs;
@@ -26,7 +26,7 @@
 
 	if(pa == nil)
 		pa = &x;
-	if(c->type < 0 || c->type >= prog->nproc || (unpack=prog->proc[c->type].unpack) == nil)
+	if((int32)c->type < 0 || c->type >= prog->nproc || (unpack=prog->proc[c->type].unpack) == nil)
 		return SunProcUnavail;
 	if((*unpack)(a, ea, pa, c) < 0){
 		fprint(2, "%ud %d: '%.*H' unpack failed\n", prog->prog, c->type, (int)(ea-a), a);
@@ -45,7 +45,7 @@
 
 	if(pa == nil)
 		pa = &x;
-	if(type < 0 || type >= prog->nproc || (unpack=prog->proc[type].unpack) == nil)
+	if((int32)type < 0 || type >= prog->nproc || (unpack=prog->proc[type].unpack) == nil)
 		return SunProcUnavail;
 	size = prog->proc[type].sizeoftype;
 	if(size == 0)
@@ -68,7 +68,7 @@
 {
 	uint (*size)(SunCall*);
 
-	if(c->type < 0 || c->type >= prog->nproc || (size=prog->proc[c->type].size) == nil)
+	if((int32)c->type < 0 || c->type >= prog->nproc || (size=prog->proc[c->type].size) == nil)
 		return ~0;
 	return (*size)(c);
 }
diff --git a/src/libsunrpc/server.c b/src/libsunrpc/server.c
index 43b0f77..6e024fc 100644
--- a/src/libsunrpc/server.c
+++ b/src/libsunrpc/server.c
@@ -216,7 +216,7 @@
 	bp = emalloc(n);
 	ep = bp+n;
 	p = bp;
-	if(sunrpcpack(p, ep, &p, &m->rpc) < 0){
+	if((int32)sunrpcpack(p, ep, &p, &m->rpc) < 0){
 		fprint(2, "sunrpcpack failed\n");
 		sunmsgdrop(m);
 		return 0;