[PATCH 4/5] Make style consistent

From: FRIGN <dev_AT_frign.de>
Date: Wed, 8 Jul 2015 20:29:54 +0200

and bring the code to the guidelines brought in the suckless
styleguide.
This style is already used for the 19k+ lines of code of sbase
and ubase and has proven itself to be easy and fun to work with.

The patches in the wiki will be fixed accordingly, given they
are broken anyway for the current git head.
The earlier this style transition happens, the better. All future
work will be according to the general suckless style.
---
 st.c | 1509 +++++++++++++++++++++++++++++++++-----------------------------=
----
 1 file changed, 744 insertions(+), 765 deletions(-)
diff --git a/st.c b/st.c
index 2c1c6e8..344b6cb 100644
--- a/st.c
+++ b/st.c
_AT_@ -59,22 +59,24 @@ char *argv0;
 #define STR_ARG_SIZ   ESC_ARG_SIZ
 #define XK_ANY_MOD    UINT_MAX
 #define XK_NO_MOD     0
-#define XK_SWITCH_MOD (1<<13)
+#define XK_SWITCH_MOD (1 << 13)
=20
 /* macros */
-#define MIN(a, b)  ((a) < (b) ? (a) : (b))
-#define MAX(a, b)  ((a) < (b) ? (b) : (a))
-#define LEN(a)     (sizeof(a) / sizeof(a)[0])
-#define DEFAULT(a, b)     (a) =3D (a) ? (a) : (b)
-#define BETWEEN(x, a, b)  ((a) <=3D (x) && (x) <=3D (b))
-#define ISCONTROLC0(c) (BETWEEN(c, 0, 0x1f) || (c) =3D=3D '\177')
-#define ISCONTROLC1(c) (BETWEEN(c, 0x80, 0x9f))
-#define ISCONTROL(c) (ISCONTROLC0(c) || ISCONTROLC1(c))
-#define ISDELIM(u) (utf8strchr(worddelimiters, u) !=3D NULL)
-#define LIMIT(x, a, b)    (x) =3D (x) < (a) ? (a) : (x) > (b) ? (b) : (x)
-#define ATTRCMP(a, b) ((a).mode !=3D (b).mode || (a).fg !=3D (b).fg || (a)=
.bg !=3D (b).bg)
-#define IS_SET(flag) ((term.mode & (flag)) !=3D 0)
-#define TIMEDIFF(t1, t2) ((t1.tv_sec-t2.tv_sec)*1000 + (t1.tv_nsec-t2.tv_n=
sec)/1E6)
+#define MIN(a, b)           ((a) < (b) ? (a) : (b))
+#define MAX(a, b)           ((a) < (b) ? (b) : (a))
+#define LEN(a)              (sizeof(a) / sizeof(a)[0])
+#define DEFAULT(a, b)       (a) =3D (a) ? (a) : (b)
+#define BETWEEN(x, a, b)    ((a) <=3D (x) && (x) <=3D (b))
+#define ISCONTROLC0(c)      (BETWEEN(c, 0, 0x1f) || (c) =3D=3D '\177')
+#define ISCONTROLC1(c)      (BETWEEN(c, 0x80, 0x9f))
+#define ISCONTROL(c)        (ISCONTROLC0(c) || ISCONTROLC1(c))
+#define ISDELIM(u)          (utf8strchr(worddelimiters, u) !=3D NULL)
+#define LIMIT(x, a, b)      (x) =3D (x) < (a) ? (a) : (x) > (b) ? (b) : (x)
+#define ATTRCMP(a, b)       ((a).mode !=3D (b).mode || (a).fg !=3D (b).fg =
|| \
+                            (a).bg !=3D (b).bg)
+#define IS_SET(flag)        ((term.mode & (flag)) !=3D 0)
+#define TIMEDIFF(t1, t2)    (((t1).tv_sec - (t2).tv_sec) * 1000 + \
+                            ((t1).tv_nsec - (t2).tv_nsec) / 1E6)
 #define MODBIT(x, set, bit) ((set) ? ((x) |=3D (bit)) : ((x) &=3D ~(bit)))
=20
 #define TRUECOLOR(r,g,b) (1 << 24 | (r) << 16 | (g) << 8 | (b))
_AT_@ -102,13 +104,13 @@ enum glyph_attribute {
=20
 enum cursor_movement {
 	CURSOR_SAVE,
-	CURSOR_LOAD
+	CURSOR_LOAD,
 };
=20
 enum cursor_state {
 	CURSOR_DEFAULT  =3D 0,
 	CURSOR_WRAPNEXT =3D 1,
-	CURSOR_ORIGIN   =3D 2
+	CURSOR_ORIGIN   =3D 2,
 };
=20
 enum term_mode {
_AT_@ -133,8 +135,8 @@ enum term_mode {
 	MODE_MOUSEMANY   =3D 1 << 18,
 	MODE_BRCKTPASTE  =3D 1 << 19,
 	MODE_PRINT       =3D 1 << 20,
-	MODE_MOUSE       =3D MODE_MOUSEBTN|MODE_MOUSEMOTION|MODE_MOUSEX10\
-	                  |MODE_MOUSEMANY,
+	MODE_MOUSE       =3D MODE_MOUSEBTN | MODE_MOUSEMOTION | MODE_MOUSEX10 | \
+	                   MODE_MOUSEMANY,
 };
=20
 enum charset {
_AT_@ -144,7 +146,7 @@ enum charset {
 	CS_USA,
 	CS_MULTI,
 	CS_GER,
-	CS_FIN
+	CS_FIN,
 };
=20
 enum escape_state {
_AT_@ -153,28 +155,28 @@ enum escape_state {
 	ESC_STR        =3D 4,  /* DCS, OSC, PM, APC */
 	ESC_ALTCHARSET =3D 8,
 	ESC_STR_END    =3D 16, /* a final string was encountered */
-	ESC_TEST       =3D 32, /* Enter in test mode */
+	ESC_TEST       =3D 32, /* enter in test mode */
 };
=20
 enum window_state {
 	WIN_VISIBLE =3D 1,
-	WIN_FOCUSED =3D 2
+	WIN_FOCUSED =3D 2,
 };
=20
 enum selection_mode {
-	SEL_IDLE =3D 0,
+	SEL_IDLE  =3D 0,
 	SEL_EMPTY =3D 1,
-	SEL_READY =3D 2
+	SEL_READY =3D 2,
 };
=20
 enum selection_type {
-	SEL_REGULAR =3D 1,
-	SEL_RECTANGULAR =3D 2
+	SEL_REGULAR     =3D 1,
+	SEL_RECTANGULAR =3D 2,
 };
=20
 enum selection_snap {
 	SNAP_WORD =3D 1,
-	SNAP_LINE =3D 2
+	SNAP_LINE =3D 2,
 };
=20
 typedef unsigned char uchar;
_AT_@ -257,7 +259,7 @@ typedef struct {
 	Visual   *vis;
 	XSetWindowAttributes attrs;
 	int      scr;
-	int      isfixed; /* is fixed geometry? */
+	int      isfixed; /* fixed geometry */
 	int      l, t;    /* left and top offset */
 	int      gm;      /* geometry mask */
 	int      tw, th;  /* tty width and height */
_AT_@ -332,7 +334,6 @@ static void printsel(const Arg *);
 static void printscreen(const Arg *) ;
 static void toggleprinter(const Arg *);
=20
-/* Config.h for applying patches and the configuration. */
 #include "config.h"
=20
 /* Font structure */
_AT_@ -483,23 +484,23 @@ static char *xstrdup(char *);
 static void usage(void);
=20
 static void (*handler[LASTEvent])(XEvent *) =3D {
-	[KeyPress] =3D kpress,
-	[ClientMessage] =3D cmessage,
-	[ConfigureNotify] =3D resize,
+	[KeyPress]         =3D kpress,
+	[ClientMessage]    =3D cmessage,
+	[ConfigureNotify]  =3D resize,
 	[VisibilityNotify] =3D visibility,
-	[UnmapNotify] =3D unmap,
-	[Expose] =3D expose,
-	[FocusIn] =3D focus,
-	[FocusOut] =3D focus,
-	[MotionNotify] =3D bmotion,
-	[ButtonPress] =3D bpress,
-	[ButtonRelease] =3D brelease,
+	[UnmapNotify]      =3D unmap,
+	[Expose]           =3D expose,
+	[FocusIn]          =3D focus,
+	[FocusOut]         =3D focus,
+	[MotionNotify]     =3D bmotion,
+	[ButtonPress]      =3D bpress,
+	[ButtonRelease]    =3D brelease,
 /*
  * Uncomment if you want the selection to disappear when you select someth=
ing
  * different in another window.
  */
-/*	[SelectionClear] =3D selclear, */
-	[SelectionNotify] =3D selnotify,
+/*	[SelectionClear]   =3D selclear, */
+	[SelectionNotify]  =3D selnotify,
 	[SelectionRequest] =3D selrequest,
 };
=20
_AT_@ -526,10 +527,10 @@ static char *usedfont =3D NULL;
 static double usedfontsize =3D 0;
 static double defaultfontsize =3D 0;
=20
-static uchar utfbyte[UTF_SIZ + 1] =3D {0x80,    0, 0xC0, 0xE0, 0xF0};
-static uchar utfmask[UTF_SIZ + 1] =3D {0xC0, 0x80, 0xE0, 0xF0, 0xF8};
-static Rune utfmin[UTF_SIZ + 1] =3D {       0,    0,  0x80,  0x800,  0x100=
00};
-static Rune utfmax[UTF_SIZ + 1] =3D {0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10FF=
FF};
+static uchar utfbyte[UTF_SIZ + 1] =3D { 0x80,    0, 0xC0, 0xE0, 0xF0 };
+static uchar utfmask[UTF_SIZ + 1] =3D { 0xC0, 0x80, 0xE0, 0xF0, 0xF8 };
+static Rune utfmin[UTF_SIZ + 1] =3D {        0,    0,  0x80,  0x800,  0x10=
000 };
+static Rune utfmax[UTF_SIZ + 1] =3D { 0x10FFFF, 0x7F, 0x7FF, 0xFFFF, 0x10F=
FFF };
=20
 /* Font Ring Cache */
 enum {
_AT_@ -553,21 +554,22 @@ ssize_t
 xwrite(int fd, const char *s, size_t len) {
 	size_t aux =3D len;
=20
-	while(len > 0) {
+	while (len > 0) {
 		ssize_t r =3D write(fd, s, len);
-		if(r < 0)
+		if (r < 0)
 			return r;
 		len -=3D r;
 		s +=3D r;
 	}
+
 	return aux;
 }
=20
 void *
 xmalloc(size_t len) {
-	void *p =3D malloc(len);
+	void *p;
=20
-	if(!p)
+	if (!(p =3D malloc(len)))
 		die("Out of memory\n");
=20
 	return p;
_AT_@ -575,7 +577,7 @@ xmalloc(size_t len) {
=20
 void *
 xrealloc(void *p, size_t len) {
-	if((p =3D realloc(p, len)) =3D=3D NULL)
+	if (!(p =3D realloc(p, len)))
 		die("Out of memory\n");
=20
 	return p;
_AT_@ -583,7 +585,7 @@ xrealloc(void *p, size_t len) {
=20
 char *
 xstrdup(char *s) {
-	if((s =3D strdup(s)) =3D=3D NULL)
+	if (!(s =3D strdup(s)))
 		die("Out of memory\n");
=20
 	return s;
_AT_@ -591,32 +593,34 @@ xstrdup(char *s) {
=20
 size_t
 utf8decode(char *c, Rune *u, size_t clen) {
-	size_t i, j, len, type;
 	Rune udecoded;
+	size_t i, j, len, type;
=20
 	*u =3D UTF_INVALID;
-	if(!clen)
+	if (!clen)
 		return 0;
 	udecoded =3D utf8decodebyte(c[0], &len);
-	if(!BETWEEN(len, 1, UTF_SIZ))
+	if (!BETWEEN(len, 1, UTF_SIZ))
 		return 1;
-	for(i =3D 1, j =3D 1; i < clen && j < len; ++i, ++j) {
+	for (i =3D 1, j =3D 1; i < clen && j < len; ++i, ++j) {
 		udecoded =3D (udecoded << 6) | utf8decodebyte(c[i], &type);
-		if(type !=3D 0)
+		if (type !=3D 0)
 			return j;
 	}
-	if(j < len)
+	if (j < len)
 		return 0;
 	*u =3D udecoded;
 	utf8validate(u, len);
+
 	return len;
 }
=20
 Rune
 utf8decodebyte(char c, size_t *i) {
-	for(*i =3D 0; *i < LEN(utfmask); ++(*i))
-		if(((uchar)c & utfmask[*i]) =3D=3D utfbyte[*i])
+	for (*i =3D 0; *i < LEN(utfmask); ++(*i))
+		if (((uchar)c & utfmask[*i]) =3D=3D utfbyte[*i])
 			return (uchar)c & ~utfmask[*i];
+
 	return 0;
 }
=20
_AT_@ -625,13 +629,14 @@ utf8encode(Rune u, char *c) {
 	size_t len, i;
=20
 	len =3D utf8validate(&u, 0);
-	if(len > UTF_SIZ)
+	if (len > UTF_SIZ)
 		return 0;
-	for(i =3D len - 1; i !=3D 0; --i) {
+	for (i =3D len - 1; i !=3D 0; --i) {
 		c[i] =3D utf8encodebyte(u, 0);
 		u >>=3D 6;
 	}
 	c[0] =3D utf8encodebyte(u, len);
+
 	return len;
 }
=20
_AT_@ -646,21 +651,23 @@ utf8strchr(char *s, Rune u) {
 	size_t i, j, len;
=20
 	len =3D strlen(s);
-	for(i =3D 0, j =3D 0; i < len; i +=3D j) {
-		if(!(j =3D utf8decode(&s[i], &r, len - i)))
+	for (i =3D 0, j =3D 0; i < len; i +=3D j) {
+		if (!(j =3D utf8decode(&s[i], &r, len - i)))
 			break;
-		if(r =3D=3D u)
+		if (r =3D=3D u)
 			return &(s[i]);
 	}
+
 	return NULL;
 }
=20
 size_t
 utf8validate(Rune *u, size_t i) {
-	if(!BETWEEN(*u, utfmin[i], utfmax[i]) || BETWEEN(*u, 0xD800, 0xDFFF))
+	if (!BETWEEN(*u, utfmin[i], utfmax[i]) || BETWEEN(*u, 0xD800, 0xDFFF))
 		*u =3D UTF_INVALID;
-	for(i =3D 1; *u > utfmax[i]; ++i)
+	for (i =3D 1; *u > utfmax[i]; ++i)
 		;
+
 	return i;
 }
=20
_AT_@ -668,12 +675,12 @@ void
 selinit(void) {
 	memset(&sel.tclick1, 0, sizeof(sel.tclick1));
 	memset(&sel.tclick2, 0, sizeof(sel.tclick2));
-	sel.mode =3D SEL_IDLE;
-	sel.ob.x =3D -1;
-	sel.primary =3D NULL;
+	sel.mode      =3D SEL_IDLE;
+	sel.ob.x      =3D -1;
+	sel.primary   =3D NULL;
 	sel.clipboard =3D NULL;
-	sel.xtarget =3D XInternAtom(xw.dpy, "UTF8_STRING", 0);
-	if(sel.xtarget =3D=3D None)
+	sel.xtarget   =3D XInternAtom(xw.dpy, "UTF8_STRING", 0);
+	if (sel.xtarget =3D=3D None)
 		sel.xtarget =3D XA_STRING;
 }
=20
_AT_@ -682,7 +689,7 @@ x2col(int x) {
 	x -=3D borderpx;
 	x /=3D xw.cw;
=20
-	return LIMIT(x, 0, term.col-1);
+	return LIMIT(x, 0, term.col - 1);
 }
=20
 int
_AT_@ -690,17 +697,17 @@ y2row(int y) {
 	y -=3D borderpx;
 	y /=3D xw.ch;
=20
-	return LIMIT(y, 0, term.row-1);
+	return LIMIT(y, 0, term.row - 1);
 }
=20
 int
 tlinelen(int y) {
 	int i =3D term.col;
=20
-	if(term.line[y][i - 1].mode & ATTR_WRAP)
+	if (term.line[y][i - 1].mode & ATTR_WRAP)
 		return i;
=20
-	while(i > 0 && term.line[y][i - 1].u =3D=3D ' ')
+	while (i > 0 && term.line[y][i - 1].u =3D=3D ' ')
 		--i;
=20
 	return i;
_AT_@ -710,7 +717,7 @@ void
 selnormalize(void) {
 	int i;
=20
-	if(sel.type =3D=3D SEL_REGULAR && sel.ob.y !=3D sel.oe.y) {
+	if (sel.type =3D=3D SEL_REGULAR && sel.ob.y !=3D sel.oe.y) {
 		sel.nb.x =3D sel.ob.y < sel.oe.y ? sel.ob.x : sel.oe.x;
 		sel.ne.x =3D sel.ob.y < sel.oe.y ? sel.oe.x : sel.ob.x;
 	} else {
_AT_@ -735,25 +742,25 @@ selnormalize(void) {
=20
 int
 selected(int x, int y) {
-	if(sel.mode =3D=3D SEL_EMPTY)
+	if (sel.mode =3D=3D SEL_EMPTY)
 		return 0;
=20
-	if(sel.type =3D=3D SEL_RECTANGULAR)
-		return BETWEEN(y, sel.nb.y, sel.ne.y)
-		    && BETWEEN(x, sel.nb.x, sel.ne.x);
+	if (sel.type =3D=3D SEL_RECTANGULAR)
+		return BETWEEN(y, sel.nb.y, sel.ne.y) &&
+		       BETWEEN(x, sel.nb.x, sel.ne.x);
=20
-	return BETWEEN(y, sel.nb.y, sel.ne.y)
-	    && (y !=3D sel.nb.y || x >=3D sel.nb.x)
-	    && (y !=3D sel.ne.y || x <=3D sel.ne.x);
+	return BETWEEN(y, sel.nb.y, sel.ne.y) &&
+	       (y !=3D sel.nb.y || x >=3D sel.nb.x) &&
+	       (y !=3D sel.ne.y || x <=3D sel.ne.x);
 }
=20
 void
 selsnap(int *x, int *y, int direction) {
+	Glyph *gp, *prevgp;
 	int newx, newy, xt, yt;
 	int delim, prevdelim;
-	Glyph *gp, *prevgp;
=20
-	switch(sel.snap) {
+	switch (sel.snap) {
 	case SNAP_WORD:
 		/*
 		 * Snap around if the word wraps around at the end or
_AT_@ -761,20 +768,20 @@ selsnap(int *x, int *y, int direction) {
 		 */
 		prevgp =3D &term.line[*y][*x];
 		prevdelim =3D ISDELIM(prevgp->u);
-		for(;;) {
+		for (;;) {
 			newx =3D *x + direction;
 			newy =3D *y;
-			if(!BETWEEN(newx, 0, term.col - 1)) {
+			if (!BETWEEN(newx, 0, term.col - 1)) {
 				newy +=3D direction;
 				newx =3D (newx + term.col) % term.col;
 				if (!BETWEEN(newy, 0, term.row - 1))
 					break;
=20
-				if(direction > 0)
+				if (direction > 0)
 					yt =3D *y, xt =3D *x;
 				else
 					yt =3D newy, xt =3D newx;
-				if(!(term.line[yt][xt].mode & ATTR_WRAP))
+				if (!(term.line[yt][xt].mode & ATTR_WRAP))
 					break;
 			}
=20
_AT_@ -783,8 +790,8 @@ selsnap(int *x, int *y, int direction) {
=20
 			gp =3D &term.line[newy][newx];
 			delim =3D ISDELIM(gp->u);
-			if(!(gp->mode & ATTR_WDUMMY) && (delim !=3D prevdelim
-					|| (delim && gp->u !=3D prevgp->u)))
+			if (!(gp->mode & ATTR_WDUMMY) &&
+			    (delim !=3D prevdelim || (delim && gp->u !=3D prevgp->u)))
 				break;
=20
 			*x =3D newx;
_AT_@ -800,17 +807,15 @@ selsnap(int *x, int *y, int direction) {
 		 * previous line will be selected.
 		 */
 		*x =3D (direction < 0) ? 0 : term.col - 1;
-		if(direction < 0) {
-			for(; *y > 0; *y +=3D direction) {
-				if(!(term.line[*y-1][term.col-1].mode
-						& ATTR_WRAP)) {
+		if (direction < 0) {
+			for (; *y > 0; *y +=3D direction) {
+				if (!(term.line[*y - 1][term.col - 1].mode & ATTR_WRAP)) {
 					break;
 				}
 			}
-		} else if(direction > 0) {
-			for(; *y < term.row-1; *y +=3D direction) {
-				if(!(term.line[*y][term.col-1].mode
-						& ATTR_WRAP)) {
+		} else if (direction > 0) {
+			for (; *y < term.row - 1; *y +=3D direction) {
+				if (!(term.line[*y][term.col - 1].mode & ATTR_WRAP)) {
 					break;
 				}
 			}
_AT_@ -824,15 +829,15 @@ getbuttoninfo(XEvent *e) {
 	int type;
 	uint state =3D e->xbutton.state & ~(Button1Mask | forceselmod);
=20
-	sel.alt =3D IS_SET(MODE_ALTSCREEN);
+	sel.alt  =3D IS_SET(MODE_ALTSCREEN);
=20
 	sel.oe.x =3D x2col(e->xbutton.x);
 	sel.oe.y =3D y2row(e->xbutton.y);
 	selnormalize();
=20
 	sel.type =3D SEL_REGULAR;
-	for(type =3D 1; type < LEN(selmasks); ++type) {
-		if(match(selmasks[type], state)) {
+	for (type =3D 1; type < LEN(selmasks); ++type) {
+		if (match(selmasks[type], state)) {
 			sel.type =3D type;
 			break;
 		}
_AT_@ -842,59 +847,58 @@ getbuttoninfo(XEvent *e) {
 void
 mousereport(XEvent *e) {
 	int x =3D x2col(e->xbutton.x), y =3D y2row(e->xbutton.y),
-	    button =3D e->xbutton.button, state =3D e->xbutton.state,
-	    len;
-	char buf[40];
+	    button =3D e->xbutton.button, state =3D e->xbutton.state, len;
 	static int ox, oy;
+	char buf[40];
=20
 	/* from urxvt */
-	if(e->xbutton.type =3D=3D MotionNotify) {
-		if(x =3D=3D ox && y =3D=3D oy)
+	if (e->xbutton.type =3D=3D MotionNotify) {
+		if (x =3D=3D ox && y =3D=3D oy)
 			return;
-		if(!IS_SET(MODE_MOUSEMOTION) && !IS_SET(MODE_MOUSEMANY))
+		if (!IS_SET(MODE_MOUSEMOTION) && !IS_SET(MODE_MOUSEMANY))
 			return;
 		/* MOUSE_MOTION: no reporting if no button is pressed */
-		if(IS_SET(MODE_MOUSEMOTION) && oldbutton =3D=3D 3)
+		if (IS_SET(MODE_MOUSEMOTION) && oldbutton =3D=3D 3)
 			return;
=20
 		button =3D oldbutton + 32;
 		ox =3D x;
 		oy =3D y;
 	} else {
-		if(!IS_SET(MODE_MOUSESGR) && e->xbutton.type =3D=3D ButtonRelease) {
+		if (!IS_SET(MODE_MOUSESGR) && e->xbutton.type =3D=3D ButtonRelease) {
 			button =3D 3;
 		} else {
 			button -=3D Button1;
-			if(button >=3D 3)
+			if (button >=3D 3)
 				button +=3D 64 - 3;
 		}
-		if(e->xbutton.type =3D=3D ButtonPress) {
+		if (e->xbutton.type =3D=3D ButtonPress) {
 			oldbutton =3D button;
 			ox =3D x;
 			oy =3D y;
-		} else if(e->xbutton.type =3D=3D ButtonRelease) {
+		} else if (e->xbutton.type =3D=3D ButtonRelease) {
 			oldbutton =3D 3;
 			/* MODE_MOUSEX10: no button release reporting */
-			if(IS_SET(MODE_MOUSEX10))
+			if (IS_SET(MODE_MOUSEX10))
 				return;
 			if (button =3D=3D 64 || button =3D=3D 65)
 				return;
 		}
 	}
=20
-	if(!IS_SET(MODE_MOUSEX10)) {
-		button +=3D ((state & ShiftMask  ) ? 4  : 0)
-			+ ((state & Mod4Mask   ) ? 8  : 0)
-			+ ((state & ControlMask) ? 16 : 0);
+	if (!IS_SET(MODE_MOUSEX10)) {
+		button +=3D ((state & ShiftMask  ) ? 4  : 0) +
+		          ((state & Mod4Mask   ) ? 8  : 0) +
+		          ((state & ControlMask) ? 16 : 0);
 	}
=20
-	if(IS_SET(MODE_MOUSESGR)) {
+	if (IS_SET(MODE_MOUSESGR)) {
 		len =3D snprintf(buf, sizeof(buf), "\033[<%d;%d;%d%c",
-				button, x+1, y+1,
-				e->xbutton.type =3D=3D ButtonRelease ? 'm' : 'M');
-	} else if(x < 223 && y < 223) {
+		               button, x + 1, y + 1,
+		               e->xbutton.type =3D=3D ButtonRelease ? 'm' : 'M');
+	} else if (x < 223 && y < 223) {
 		len =3D snprintf(buf, sizeof(buf), "\033[M%c%c%c",
-				32+button, 32+x+1, 32+y+1);
+		               32 + button, 32 + x + 1, 32 + y + 1);
 	} else {
 		return;
 	}
_AT_@ -907,20 +911,20 @@ bpress(XEvent *e) {
 	struct timespec now;
 	Mousekey *mk;
=20
-	if(IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
+	if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
 		mousereport(e);
 		return;
 	}
=20
-	for(mk =3D mshortcuts; mk < mshortcuts + LEN(mshortcuts); mk++) {
-		if(e->xbutton.button =3D=3D mk->b
-				&& match(mk->mask, e->xbutton.state)) {
+	for (mk =3D mshortcuts; mk < mshortcuts + LEN(mshortcuts); mk++) {
+		if (e->xbutton.button =3D=3D mk->b &&
+		    match(mk->mask, e->xbutton.state)) {
 			ttysend(mk->s, strlen(mk->s));
 			return;
 		}
 	}
=20
-	if(e->xbutton.button =3D=3D Button1) {
+	if (e->xbutton.button =3D=3D Button1) {
 		clock_gettime(CLOCK_MONOTONIC, &now);
=20
 		/* Clear previous selection, logically and visually. */
_AT_@ -934,16 +938,16 @@ bpress(XEvent *e) {
 		 * If the user clicks below predefined timeouts specific
 		 * snapping behaviour is exposed.
 		 */
-		if(TIMEDIFF(now, sel.tclick2) <=3D tripleclicktimeout) {
+		if (TIMEDIFF(now, sel.tclick2) <=3D tripleclicktimeout) {
 			sel.snap =3D SNAP_LINE;
-		} else if(TIMEDIFF(now, sel.tclick1) <=3D doubleclicktimeout) {
+		} else if (TIMEDIFF(now, sel.tclick1) <=3D doubleclicktimeout) {
 			sel.snap =3D SNAP_WORD;
 		} else {
 			sel.snap =3D 0;
 		}
 		selnormalize();
=20
-		if(sel.snap !=3D 0)
+		if (sel.snap)
 			sel.mode =3D SEL_READY;
 		tsetdirt(sel.nb.y, sel.ne.y);
 		sel.tclick2 =3D sel.tclick1;
_AT_@ -953,33 +957,33 @@ bpress(XEvent *e) {
=20
 char *
 getsel(void) {
-	char *str, *ptr;
-	int y, bufsize, lastx, linelen;
 	Glyph *gp, *last;
+	int y, bufsize, lastx, linelen;
+	char *str, *ptr;
=20
-	if(sel.ob.x =3D=3D -1)
+	if (sel.ob.x =3D=3D -1)
 		return NULL;
=20
-	bufsize =3D (term.col+1) * (sel.ne.y-sel.nb.y+1) * UTF_SIZ;
+	bufsize =3D (term.col + 1) * (sel.ne.y - sel.nb.y + 1) * UTF_SIZ;
 	ptr =3D str =3D xmalloc(bufsize);
=20
 	/* append every set & selected glyph to the selection */
-	for(y =3D sel.nb.y; y <=3D sel.ne.y; y++) {
+	for (y =3D sel.nb.y; y <=3D sel.ne.y; y++) {
 		linelen =3D tlinelen(y);
=20
-		if(sel.type =3D=3D SEL_RECTANGULAR) {
+		if (sel.type =3D=3D SEL_RECTANGULAR) {
 			gp =3D &term.line[y][sel.nb.x];
 			lastx =3D sel.ne.x;
 		} else {
 			gp =3D &term.line[y][sel.nb.y =3D=3D y ? sel.nb.x : 0];
-			lastx =3D (sel.ne.y =3D=3D y) ? sel.ne.x : term.col-1;
+			lastx =3D (sel.ne.y =3D=3D y) ? sel.ne.x : term.col - 1;
 		}
-		last =3D &term.line[y][MIN(lastx, linelen-1)];
-		while(last >=3D gp && last->u =3D=3D ' ')
+		last =3D &term.line[y][MIN(lastx, linelen - 1)];
+		while (last >=3D gp && last->u =3D=3D ' ')
 			--last;
=20
-		for( ; gp <=3D last; ++gp) {
-			if(gp->mode & ATTR_WDUMMY)
+		for ( ; gp <=3D last; ++gp) {
+			if (gp->mode & ATTR_WDUMMY)
 				continue;
=20
 			ptr +=3D utf8encode(gp->u, ptr);
_AT_@ -994,10 +998,11 @@ getsel(void) {
 		 * st.
 		 * FIXME: Fix the computer world.
 		 */
-		if((y < sel.ne.y || lastx >=3D linelen) && !(last->mode & ATTR_WRAP))
+		if ((y < sel.ne.y || lastx >=3D linelen) && !(last->mode & ATTR_WRAP))
 			*ptr++ =3D '\n';
 	}
 	*ptr =3D 0;
+
 	return str;
 }
=20
_AT_@ -1008,21 +1013,20 @@ selcopy(Time t) {
=20
 void
 selnotify(XEvent *e) {
+	Atom type;
+	XSelectionEvent *xsev;
 	ulong nitems, ofs, rem;
 	int format;
 	uchar *data, *last, *repl;
-	Atom type;
-	XSelectionEvent *xsev;
=20
 	ofs =3D 0;
 	xsev =3D &e->xselection;
 	if (xsev->property =3D=3D None)
 	    return;
 	do {
-		if(XGetWindowProperty(xw.dpy, xw.win, xsev->property, ofs,
-					BUFSIZ/4, False, AnyPropertyType,
-					&type, &format, &nitems, &rem,
-					&data)) {
+		if (XGetWindowProperty(xw.dpy, xw.win, xsev->property, ofs,
+		                       BUFSIZ/4, 0, AnyPropertyType,
+		                       &type, &format, &nitems, &rem, &data)) {
 			fprintf(stderr, "Clipboard allocation failed\n");
 			return;
 		}
_AT_@ -1036,19 +1040,19 @@ selnotify(XEvent *e) {
 		 */
 		repl =3D data;
 		last =3D data + nitems * format / 8;
-		while((repl =3D memchr(repl, '\n', last - repl))) {
+		while ((repl =3D memchr(repl, '\n', last - repl))) {
 			*repl++ =3D '\r';
 		}
=20
-		if(IS_SET(MODE_BRCKTPASTE))
+		if (IS_SET(MODE_BRCKTPASTE))
 			ttywrite("\033[200~", 6);
 		ttysend((char *)data, nitems * format / 8);
-		if(IS_SET(MODE_BRCKTPASTE))
+		if (IS_SET(MODE_BRCKTPASTE))
 			ttywrite("\033[201~", 6);
 		XFree(data);
 		/* number of 32-bit chunks returned */
 		ofs +=3D nitems * format / 32;
-	} while(rem > 0);
+	} while (rem > 0);
 }
=20
 void
_AT_@ -1061,10 +1065,10 @@ void
 clipcopy(const Arg *dummy) {
 	Atom clipboard;
=20
-	if(sel.clipboard !=3D NULL)
+	if (sel.clipboard)
 		free(sel.clipboard);
=20
-	if(sel.primary !=3D NULL) {
+	if (sel.primary) {
 		sel.clipboard =3D xstrdup(sel.primary);
 		clipboard =3D XInternAtom(xw.dpy, "CLIPBOARD", 0);
 		XSetSelectionOwner(xw.dpy, clipboard, xw.win, CurrentTime);
_AT_@ -1077,12 +1081,12 @@ clippaste(const Arg *dummy) {
=20
 	clipboard =3D XInternAtom(xw.dpy, "CLIPBOARD", 0);
 	XConvertSelection(xw.dpy, clipboard, sel.xtarget, clipboard,
-			xw.win, CurrentTime);
+	                  xw.win, CurrentTime);
 }
=20
 void
 selclear(XEvent *e) {
-	if(sel.ob.x =3D=3D -1)
+	if (sel.ob.x =3D=3D -1)
 		return;
 	sel.mode =3D SEL_IDLE;
 	sel.ob.x =3D -1;
_AT_@ -1091,17 +1095,17 @@ selclear(XEvent *e) {
=20
 void
 selrequest(XEvent *e) {
-	XSelectionRequestEvent *xsre;
-	XSelectionEvent xev;
 	Atom xa_targets, string, clipboard;
+	XSelectionEvent xev;
+	XSelectionRequestEvent *xsre;
 	char *seltext;
=20
-	xsre =3D (XSelectionRequestEvent *) e;
-	xev.type =3D SelectionNotify;
+	xsre          =3D (XSelectionRequestEvent *) e;
+	xev.type      =3D SelectionNotify;
 	xev.requestor =3D xsre->requestor;
 	xev.selection =3D xsre->selection;
-	xev.target =3D xsre->target;
-	xev.time =3D xsre->time;
+	xev.target    =3D xsre->target;
+	xev.time      =3D xsre->time;
 	if (xsre->property =3D=3D None)
 		xsre->property =3D xsre->target;
=20
_AT_@ -1109,40 +1113,38 @@ selrequest(XEvent *e) {
 	xev.property =3D None;
=20
 	xa_targets =3D XInternAtom(xw.dpy, "TARGETS", 0);
-	if(xsre->target =3D=3D xa_targets) {
+	if (xsre->target =3D=3D xa_targets) {
 		/* respond with the supported type */
 		string =3D sel.xtarget;
 		XChangeProperty(xsre->display, xsre->requestor, xsre->property,
-				XA_ATOM, 32, PropModeReplace,
-				(uchar *) &string, 1);
+		                XA_ATOM, 32, PropModeReplace, (uchar *) &string, 1);
 		xev.property =3D xsre->property;
-	} else if(xsre->target =3D=3D sel.xtarget || xsre->target =3D=3D XA_STRIN=
G) {
+	} else if (xsre->target =3D=3D sel.xtarget || xsre->target =3D=3D XA_STRI=
NG) {
 		/*
 		 * xith XA_STRING non ascii characters may be incorrect in the
 		 * requestor. It is not our problem, use utf8.
 		 */
 		clipboard =3D XInternAtom(xw.dpy, "CLIPBOARD", 0);
-		if(xsre->selection =3D=3D XA_PRIMARY) {
+		if (xsre->selection =3D=3D XA_PRIMARY) {
 			seltext =3D sel.primary;
-		} else if(xsre->selection =3D=3D clipboard) {
+		} else if (xsre->selection =3D=3D clipboard) {
 			seltext =3D sel.clipboard;
 		} else {
-			fprintf(stderr,
-				"Unhandled clipboard selection 0x%lx\n",
-				xsre->selection);
+			fprintf(stderr, "Unhandled clipboard selection 0x%lx\n",
+			        xsre->selection);
 			return;
 		}
-		if(seltext !=3D NULL) {
+		if (seltext) {
 			XChangeProperty(xsre->display, xsre->requestor,
-					xsre->property, xsre->target,
-					8, PropModeReplace,
-					(uchar *)seltext, strlen(seltext));
+			                xsre->property, xsre->target,
+			                8, PropModeReplace,
+			                (uchar *)seltext, strlen(seltext));
 			xev.property =3D xsre->property;
 		}
 	}
=20
 	/* all done, send a notification to the listener */
-	if(!XSendEvent(xsre->display, xsre->requestor, True, 0, (XEvent *) &xev))
+	if (!XSendEvent(xsre->display, xsre->requestor, 1, 0, (XEvent *) &xev))
 		fprintf(stderr, "Error sending SelectionNotify event\n");
 }
=20
_AT_@ -1158,19 +1160,20 @@ xsetsel(char *str, Time t) {
=20
 void
 brelease(XEvent *e) {
-	if(IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
+	if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
 		mousereport(e);
 		return;
 	}
=20
-	if(e->xbutton.button =3D=3D Button2) {
+	if (e->xbutton.button =3D=3D Button2) {
 		selpaste(NULL);
-	} else if(e->xbutton.button =3D=3D Button1) {
-		if(sel.mode =3D=3D SEL_READY) {
+	} else if (e->xbutton.button =3D=3D Button1) {
+		if (sel.mode =3D=3D SEL_READY) {
 			getbuttoninfo(e);
 			selcopy(e->xbutton.time);
-		} else
+		} else {
 			selclear(NULL);
+		}
 		sel.mode =3D SEL_IDLE;
 		tsetdirt(sel.nb.y, sel.ne.y);
 	}
_AT_@ -1180,22 +1183,22 @@ void
 bmotion(XEvent *e) {
 	int oldey, oldex, oldsby, oldsey;
=20
-	if(IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
+	if (IS_SET(MODE_MOUSE) && !(e->xbutton.state & forceselmod)) {
 		mousereport(e);
 		return;
 	}
=20
-	if(!sel.mode)
+	if (!sel.mode)
 		return;
=20
 	sel.mode =3D SEL_READY;
-	oldey =3D sel.oe.y;
-	oldex =3D sel.oe.x;
-	oldsby =3D sel.nb.y;
-	oldsey =3D sel.ne.y;
+	oldey    =3D sel.oe.y;
+	oldex    =3D sel.oe.x;
+	oldsby   =3D sel.nb.y;
+	oldsey   =3D sel.ne.y;
 	getbuttoninfo(e);
=20
-	if(oldey !=3D sel.oe.y || oldex !=3D sel.oe.x)
+	if (oldey !=3D sel.oe.y || oldex !=3D sel.oe.x)
 		tsetdirt(MIN(sel.nb.y, oldsby), MAX(sel.ne.y, oldsey));
 }
=20
_AT_@ -1206,6 +1209,7 @@ die(const char *errstr, ...) {
 	va_start(ap, errstr);
 	vfprintf(stderr, errstr, ap);
 	va_end(ap);
+
 	exit(1);
 }
=20
_AT_@ -1216,8 +1220,8 @@ execsh(void) {
 	char buf[sizeof(long) * 8 + 1];
=20
 	errno =3D 0;
-	if((pw =3D getpwuid(getuid())) =3D=3D NULL) {
-		if(errno)
+	if (!(pw =3D getpwuid(getuid()))) {
+		if (errno)
 			die("getpwuid:%s\n", strerror(errno));
 		else
 			die("who are you?\n");
_AT_@ -1227,9 +1231,9 @@ execsh(void) {
 		sh =3D (pw->pw_shell[0]) ? pw->pw_shell : shell;
 	}
=20
-	if(opt_cmd)
+	if (opt_cmd)
 		prog =3D opt_cmd[0];
-	else if(utmp)
+	else if (utmp)
 		prog =3D utmp;
 	else
 		prog =3D sh;
_AT_@ -1255,22 +1259,24 @@ execsh(void) {
 	signal(SIGALRM, SIG_DFL);
=20
 	execvp(prog, args);
+
 	_exit(1);
 }
=20
 void
 sigchld(int a) {
-	int stat;
 	pid_t p;
+	int stat;
=20
-	if((p =3D waitpid(pid, &stat, WNOHANG)) < 0)
+	if ((p =3D waitpid(pid, &stat, WNOHANG)) < 0)
 		die("Waiting for pid %hd failed: %s\n", pid, strerror(errno));
=20
-	if(pid !=3D p)
+	if (pid !=3D p)
 		return;
=20
 	if (!WIFEXITED(stat) || WEXITSTATUS(stat))
 		die("child finished with error '%d'\n", stat);
+
 	exit(0);
 }
=20
_AT_@ -1278,16 +1284,16 @@ sigchld(int a) {
 void
 stty(void)
 {
-	char cmd[_POSIX_ARG_MAX], **p, *q, *s;
 	size_t n, siz;
+	char cmd[_POSIX_ARG_MAX], **p, *q, *s;
=20
-	if((n =3D strlen(stty_args)) > sizeof(cmd)-1)
+	if ((n =3D strlen(stty_args)) > sizeof(cmd) - 1)
 		die("incorrect stty parameters\n");
 	memcpy(cmd, stty_args, n);
 	q =3D cmd + n;
 	siz =3D sizeof(cmd) - n;
-	for(p =3D opt_cmd; p && (s =3D *p); ++p) {
-		if((n =3D strlen(s)) > siz-1)
+	for (p =3D opt_cmd; p && (s =3D *p); ++p) {
+		if ((n =3D strlen(s)) > siz - 1)
 			die("stty parameter length too long\n");
 		*q++ =3D ' ';
 		q =3D memcpy(q, s, n);
_AT_@ -1301,20 +1307,20 @@ stty(void)
=20
 void
 ttynew(void) {
+	struct winsize w =3D { term.row, term.col, 0, 0 };
 	int m, s;
-	struct winsize w =3D {term.row, term.col, 0, 0};
=20
-	if(opt_io) {
+	if (opt_io) {
 		term.mode |=3D MODE_PRINT;
 		iofd =3D (!strcmp(opt_io, "-")) ? 1 : open(opt_io, O_WRONLY | O_CREAT, 0=
666);
-		if(iofd < 0) {
+		if (iofd < 0) {
 			fprintf(stderr, "Error opening %s:%s\n",
-				opt_io, strerror(errno));
+			        opt_io, strerror(errno));
 		}
 	}
=20
 	if (opt_line) {
-		if((cmdfd =3D open(opt_line, O_RDWR)) < 0)
+		if ((cmdfd =3D open(opt_line, O_RDWR)) < 0)
 			die("open line failed: %s\n", strerror(errno));
 		close(0);
 		dup(cmdfd);
_AT_@ -1323,10 +1329,10 @@ ttynew(void) {
 	}
=20
 	/* seems to work fine on linux, openbsd and freebsd */
-	if(openpty(&m, &s, NULL, NULL, &w) < 0)
+	if (openpty(&m, &s, NULL, NULL, &w) < 0)
 		die("openpty failed: %s\n", strerror(errno));
=20
-	switch(pid =3D fork()) {
+	switch (pid =3D fork()) {
 	case -1:
 		die("fork failed\n");
 		break;
_AT_@ -1336,7 +1342,7 @@ ttynew(void) {
 		dup2(s, 0);
 		dup2(s, 1);
 		dup2(s, 2);
-		if(ioctl(s, TIOCSCTTY, NULL) < 0)
+		if (ioctl(s, TIOCSCTTY, NULL) < 0)
 			die("ioctl TIOCSCTTY failed: %s\n", strerror(errno));
 		close(s);
 		close(m);
_AT_@ -1352,23 +1358,23 @@ ttynew(void) {
=20
 void
 ttyread(void) {
-	static char buf[BUFSIZ];
+	Rune unicodep;
 	static int buflen =3D 0;
-	char *ptr;
 	int charsize; /* size of utf8 char in bytes */
-	Rune unicodep;
 	int ret;
+	static char buf[BUFSIZ];
+	char *ptr;
=20
 	/* append read bytes to unprocessed bytes */
-	if((ret =3D read(cmdfd, buf+buflen, LEN(buf)-buflen)) < 0)
+	if ((ret =3D read(cmdfd, buf+buflen, LEN(buf) - buflen)) < 0)
 		die("Couldn't read from shell: %s\n", strerror(errno));
=20
 	/* process every complete utf8 char */
 	buflen +=3D ret;
 	ptr =3D buf;
-	while((charsize =3D utf8decode(ptr, &unicodep, buflen))) {
+	while ((charsize =3D utf8decode(ptr, &unicodep, buflen))) {
 		tputc(unicodep);
-		ptr +=3D charsize;
+		ptr    +=3D charsize;
 		buflen -=3D charsize;
 	}
=20
_AT_@ -1378,18 +1384,18 @@ ttyread(void) {
=20
 void
 ttywrite(const char *s, size_t n) {
-	if(xwrite(cmdfd, s, n) =3D=3D -1)
+	if (xwrite(cmdfd, s, n) =3D=3D -1)
 		die("write error on tty: %s\n", strerror(errno));
 }
=20
 void
 ttysend(char *s, size_t n) {
-	int len;
 	Rune u;
+	int len;
=20
 	ttywrite(s, n);
-	if(IS_SET(MODE_ECHO))
-		while((len =3D utf8decode(s, &u, n)) > 0) {
+	if (IS_SET(MODE_ECHO))
+		while ((len =3D utf8decode(s, &u, n)) > 0) {
 			techo(u);
 			n -=3D len;
 			s +=3D len;
_AT_@ -1400,11 +1406,11 @@ void
 ttyresize(void) {
 	struct winsize w;
=20
-	w.ws_row =3D term.row;
-	w.ws_col =3D term.col;
+	w.ws_row    =3D term.row;
+	w.ws_col    =3D term.col;
 	w.ws_xpixel =3D xw.tw;
 	w.ws_ypixel =3D xw.th;
-	if(ioctl(cmdfd, TIOCSWINSZ, &w) < 0)
+	if (ioctl(cmdfd, TIOCSWINSZ, &w) < 0)
 		fprintf(stderr, "Couldn't set window size: %s\n", strerror(errno));
 }
=20
_AT_@ -1412,9 +1418,9 @@ int
 tattrset(int attr) {
 	int i, j;
=20
-	for(i =3D 0; i < term.row-1; i++) {
-		for(j =3D 0; j < term.col-1; j++) {
-			if(term.line[i][j].mode & attr)
+	for (i =3D 0; i < term.row - 1; i++) {
+		for (j =3D 0; j < term.col - 1; j++) {
+			if (term.line[i][j].mode & attr)
 				return 1;
 		}
 	}
_AT_@ -1426,10 +1432,10 @@ void
 tsetdirt(int top, int bot) {
 	int i;
=20
-	LIMIT(top, 0, term.row-1);
-	LIMIT(bot, 0, term.row-1);
+	LIMIT(top, 0, term.row - 1);
+	LIMIT(bot, 0, term.row - 1);
=20
-	for(i =3D top; i <=3D bot; i++)
+	for (i =3D top; i <=3D bot; i++)
 		term.dirty[i] =3D 1;
 }
=20
_AT_@ -1437,9 +1443,9 @@ void
 tsetdirtattr(int attr) {
 	int i, j;
=20
-	for(i =3D 0; i < term.row-1; i++) {
-		for(j =3D 0; j < term.col-1; j++) {
-			if(term.line[i][j].mode & attr) {
+	for (i =3D 0; i < term.row - 1; i++) {
+		for (j =3D 0; j < term.col - 1; j++) {
+			if (term.line[i][j].mode & attr) {
 				tsetdirt(i, i);
 				break;
 			}
_AT_@ -1457,9 +1463,9 @@ tcursor(int mode) {
 	static TCursor c[2];
 	int alt =3D IS_SET(MODE_ALTSCREEN);
=20
-	if(mode =3D=3D CURSOR_SAVE) {
+	if (mode =3D=3D CURSOR_SAVE) {
 		c[alt] =3D term.c;
-	} else if(mode =3D=3D CURSOR_LOAD) {
+	} else if (mode =3D=3D CURSOR_LOAD) {
 		term.c =3D c[alt];
 		tmoveto(c[alt].x, c[alt].y);
 	}
_AT_@ -1476,18 +1482,18 @@ treset(void) {
 	}, .x =3D 0, .y =3D 0, .state =3D CURSOR_DEFAULT};
=20
 	memset(term.tabs, 0, term.col * sizeof(*term.tabs));
-	for(i =3D tabspaces; i < term.col; i +=3D tabspaces)
+	for (i =3D tabspaces; i < term.col; i +=3D tabspaces)
 		term.tabs[i] =3D 1;
-	term.top =3D 0;
-	term.bot =3D term.row - 1;
+	term.top  =3D 0;
+	term.bot  =3D term.row - 1;
 	term.mode =3D MODE_WRAP;
 	memset(term.trantbl, CS_USA, sizeof(term.trantbl));
 	term.charset =3D 0;
=20
-	for(i =3D 0; i < 2; i++) {
+	for (i =3D 0; i < 2; i++) {
 		tmoveto(0, 0);
 		tcursor(CURSOR_SAVE);
-		tclearregion(0, 0, term.col-1, term.row-1);
+		tclearregion(0, 0, term.col - 1, term.row - 1);
 		tswapscreen();
 	}
 }
_AT_@ -1505,26 +1511,26 @@ void
 tswapscreen(void) {
 	Line *tmp =3D term.line;
=20
-	term.line =3D term.alt;
-	term.alt =3D tmp;
+	term.line  =3D term.alt;
+	term.alt   =3D tmp;
 	term.mode ^=3D MODE_ALTSCREEN;
 	tfulldirt();
 }
=20
 void
 tscrolldown(int orig, int n) {
-	int i;
 	Line temp;
+	int i;
=20
-	LIMIT(n, 0, term.bot-orig+1);
+	LIMIT(n, 0, term.bot - orig + 1);
=20
-	tsetdirt(orig, term.bot-n);
-	tclearregion(0, term.bot-n+1, term.col-1, term.bot);
+	tsetdirt(orig, term.bot - n);
+	tclearregion(0, term.bot - n + 1, term.col - 1, term.bot);
=20
-	for(i =3D term.bot; i >=3D orig+n; i--) {
+	for (i =3D term.bot; i >=3D orig + n; i--) {
 		temp =3D term.line[i];
-		term.line[i] =3D term.line[i-n];
-		term.line[i-n] =3D temp;
+		term.line[i] =3D term.line[i - n];
+		term.line[i - n] =3D temp;
 	}
=20
 	selscroll(orig, n);
_AT_@ -1535,15 +1541,15 @@ tscrollup(int orig, int n) {
 	int i;
 	Line temp;
=20
-	LIMIT(n, 0, term.bot-orig+1);
+	LIMIT(n, 0, term.bot - orig + 1);
=20
-	tclearregion(0, orig, term.col-1, orig+n-1);
+	tclearregion(0, orig, term.col - 1, orig + n - 1);
 	tsetdirt(orig+n, term.bot);
=20
-	for(i =3D orig; i <=3D term.bot-n; i++) {
+	for (i =3D orig; i <=3D term.bot - n; i++) {
 		temp =3D term.line[i];
-		term.line[i] =3D term.line[i+n];
-		term.line[i+n] =3D temp;
+		term.line[i] =3D term.line[i + n];
+		term.line[i + n] =3D temp;
 	}
=20
 	selscroll(orig, -n);
_AT_@ -1551,25 +1557,25 @@ tscrollup(int orig, int n) {
=20
 void
 selscroll(int orig, int n) {
-	if(sel.ob.x =3D=3D -1)
+	if (sel.ob.x =3D=3D -1)
 		return;
=20
-	if(BETWEEN(sel.ob.y, orig, term.bot) || BETWEEN(sel.oe.y, orig, term.bot)=
) {
-		if((sel.ob.y +=3D n) > term.bot || (sel.oe.y +=3D n) < term.top) {
+	if (BETWEEN(sel.ob.y, orig, term.bot) || BETWEEN(sel.oe.y, orig, term.bot=
)) {
+		if ((sel.ob.y +=3D n) > term.bot || (sel.oe.y +=3D n) < term.top) {
 			selclear(NULL);
 			return;
 		}
-		if(sel.type =3D=3D SEL_RECTANGULAR) {
-			if(sel.ob.y < term.top)
+		if (sel.type =3D=3D SEL_RECTANGULAR) {
+			if (sel.ob.y < term.top)
 				sel.ob.y =3D term.top;
-			if(sel.oe.y > term.bot)
+			if (sel.oe.y > term.bot)
 				sel.oe.y =3D term.bot;
 		} else {
-			if(sel.ob.y < term.top) {
+			if (sel.ob.y < term.top) {
 				sel.ob.y =3D term.top;
 				sel.ob.x =3D 0;
 			}
-			if(sel.oe.y > term.bot) {
+			if (sel.oe.y > term.bot) {
 				sel.oe.y =3D term.bot;
 				sel.oe.x =3D term.col;
 			}
_AT_@ -1582,7 +1588,7 @@ void
 tnewline(int first_col) {
 	int y =3D term.c.y;
=20
-	if(y =3D=3D term.bot) {
+	if (y =3D=3D term.bot) {
 		tscrollup(term.top, 1);
 	} else {
 		y++;
_AT_@ -1592,26 +1598,26 @@ tnewline(int first_col) {
=20
 void
 csiparse(void) {
-	char *p =3D csiescseq.buf, *np;
 	long int v;
+	char *p =3D csiescseq.buf, *np;
=20
 	csiescseq.narg =3D 0;
-	if(*p =3D=3D '?') {
+	if (*p =3D=3D '?') {
 		csiescseq.priv =3D 1;
 		p++;
 	}
=20
 	csiescseq.buf[csiescseq.len] =3D '\0';
-	while(p < csiescseq.buf+csiescseq.len) {
+	while (p < csiescseq.buf+csiescseq.len) {
 		np =3D NULL;
 		v =3D strtol(p, &np, 10);
-		if(np =3D=3D p)
+		if (np =3D=3D p)
 			v =3D 0;
-		if(v =3D=3D LONG_MAX || v =3D=3D LONG_MIN)
+		if (v =3D=3D LONG_MAX || v =3D=3D LONG_MIN)
 			v =3D -1;
 		csiescseq.arg[csiescseq.narg++] =3D v;
 		p =3D np;
-		if(*p !=3D ';' || csiescseq.narg =3D=3D ESC_ARG_SIZ)
+		if (*p !=3D ';' || csiescseq.narg =3D=3D ESC_ARG_SIZ)
 			break;
 		p++;
 	}
_AT_@ -1622,14 +1628,14 @@ csiparse(void) {
 /* for absolute user moves, when decom is set */
 void
 tmoveato(int x, int y) {
-	tmoveto(x, y + ((term.c.state & CURSOR_ORIGIN) ? term.top: 0));
+	tmoveto(x, y + (term.c.state & CURSOR_ORIGIN) ? term.top : 0);
 }
=20
 void
 tmoveto(int x, int y) {
 	int miny, maxy;
=20
-	if(term.c.state & CURSOR_ORIGIN) {
+	if (term.c.state & CURSOR_ORIGIN) {
 		miny =3D term.top;
 		maxy =3D term.bot;
 	} else {
_AT_@ -1637,42 +1643,42 @@ tmoveto(int x, int y) {
 		maxy =3D term.row - 1;
 	}
 	term.c.state &=3D ~CURSOR_WRAPNEXT;
-	term.c.x =3D LIMIT(x, 0, term.col-1);
+	term.c.x =3D LIMIT(x, 0, term.col - 1);
 	term.c.y =3D LIMIT(y, miny, maxy);
 }
=20
 void
 tsetchar(Rune u, Glyph *attr, int x, int y) {
 	static char *vt100_0[62] =3D { /* 0x41 - 0x7e */
-		"=E2=86=91", "=E2=86=93", "=E2=86=92", "=E2=86=90", "=E2=96=88", "=E2=96=
=9A", "=E2=98=83", /* A - G */
-		0, 0, 0, 0, 0, 0, 0, 0, /* H - O */
-		0, 0, 0, 0, 0, 0, 0, 0, /* P - W */
-		0, 0, 0, 0, 0, 0, 0, " ", /* X - _ */
+		"=E2=86=91", "=E2=86=93", "=E2=86=92", "=E2=86=90", "=E2=96=88", "=E2=96=
=9A", "=E2=98=83",      /* A - G */
+		0,   0,   0,   0,   0,   0,   0,   0,   /* H - O */
+		0,   0,   0,   0,   0,   0,   0,   0,   /* P - W */
+		0,   0,   0,   0,   0,   0,   0,   " ", /* X - _ */
 		"=E2=97=86", "=E2=96=92", "=E2=90=89", "=E2=90=8C", "=E2=90=8D", "=E2=90=
=8A", "=C2=B0", "=C2=B1", /* ` - g */
 		"=E2=90=A4", "=E2=90=8B", "=E2=94=98", "=E2=94=90", "=E2=94=8C", "=E2=94=
=94", "=E2=94=BC", "=E2=8E=BA", /* h - o */
 		"=E2=8E=BB", "=E2=94=80", "=E2=8E=BC", "=E2=8E=BD", "=E2=94=9C", "=E2=94=
=A4", "=E2=94=B4", "=E2=94=AC", /* p - w */
-		"=E2=94=82", "=E2=89=A4", "=E2=89=A5", "=CF=80", "=E2=89=A0", "=C2=A3", =
"=C2=B7", /* x - ~ */
+		"=E2=94=82", "=E2=89=A4", "=E2=89=A5", "=CF=80", "=E2=89=A0", "=C2=A3", =
"=C2=B7",      /* x - ~ */
 	};
=20
 	/*
 	 * The table is proudly stolen from rxvt.
 	 */
-	if(term.trantbl[term.charset] =3D=3D CS_GRAPHIC0 &&
-	   BETWEEN(u, 0x41, 0x7e) && vt100_0[u - 0x41])
+	if (term.trantbl[term.charset] =3D=3D CS_GRAPHIC0 &&
+	    BETWEEN(u, 0x41, 0x7e) && vt100_0[u - 0x41])
 		utf8decode(vt100_0[u - 0x41], &u, UTF_SIZ);
=20
-	if(term.line[y][x].mode & ATTR_WIDE) {
-		if(x+1 < term.col) {
-			term.line[y][x+1].u =3D ' ';
-			term.line[y][x+1].mode &=3D ~ATTR_WDUMMY;
+	if (term.line[y][x].mode & ATTR_WIDE) {
+		if (x + 1 < term.col) {
+			term.line[y][x + 1].u     =3D ' ';
+			term.line[y][x + 1].mode &=3D ~ATTR_WDUMMY;
 		}
-	} else if(term.line[y][x].mode & ATTR_WDUMMY) {
-		term.line[y][x-1].u =3D ' ';
-		term.line[y][x-1].mode &=3D ~ATTR_WIDE;
+	} else if (term.line[y][x].mode & ATTR_WDUMMY) {
+		term.line[y][x - 1].u     =3D ' ';
+		term.line[y][x - 1].mode &=3D ~ATTR_WIDE;
 	}
=20
-	term.dirty[y] =3D 1;
-	term.line[y][x] =3D *attr;
+	term.dirty[y]     =3D 1;
+	term.line[y][x]   =3D *attr;
 	term.line[y][x].u =3D u;
 }
=20
_AT_@ -1681,26 +1687,26 @@ tclearregion(int x1, int y1, int x2, int y2) {
 	int x, y, temp;
 	Glyph *gp;
=20
-	if(x1 > x2)
+	if (x1 > x2)
 		temp =3D x1, x1 =3D x2, x2 =3D temp;
-	if(y1 > y2)
+	if (y1 > y2)
 		temp =3D y1, y1 =3D y2, y2 =3D temp;
=20
-	LIMIT(x1, 0, term.col-1);
-	LIMIT(x2, 0, term.col-1);
-	LIMIT(y1, 0, term.row-1);
-	LIMIT(y2, 0, term.row-1);
+	LIMIT(x1, 0, term.col - 1);
+	LIMIT(x2, 0, term.col - 1);
+	LIMIT(y1, 0, term.row - 1);
+	LIMIT(y2, 0, term.row - 1);
=20
-	for(y =3D y1; y <=3D y2; y++) {
+	for (y =3D y1; y <=3D y2; y++) {
 		term.dirty[y] =3D 1;
-		for(x =3D x1; x <=3D x2; x++) {
+		for (x =3D x1; x <=3D x2; x++) {
 			gp =3D &term.line[y][x];
-			if(selected(x, y))
+			if (selected(x, y))
 				selclear(NULL);
-			gp->fg =3D term.c.attr.fg;
-			gp->bg =3D term.c.attr.bg;
+			gp->fg   =3D term.c.attr.fg;
+			gp->bg   =3D term.c.attr.bg;
 			gp->mode =3D 0;
-			gp->u =3D ' ';
+			gp->u    =3D ' ';
 		}
 	}
 }
_AT_@ -1712,13 +1718,13 @@ tdeletechar(int n) {
=20
 	LIMIT(n, 0, term.col - term.c.x);
=20
-	dst =3D term.c.x;
-	src =3D term.c.x + n;
+	dst  =3D term.c.x;
+	src  =3D term.c.x + n;
 	size =3D term.col - src;
 	line =3D term.line[term.c.y];
=20
 	memmove(&line[dst], &line[src], size * sizeof(Glyph));
-	tclearregion(term.col-n, term.c.y, term.col-1, term.c.y);
+	tclearregion(term.col - n, term.c.y, term.col - 1, term.c.y);
 }
=20
 void
_AT_@ -1739,13 +1745,13 @@ tinsertblank(int n) {
=20
 void
 tinsertblankline(int n) {
-	if(BETWEEN(term.c.y, term.top, term.bot))
+	if (BETWEEN(term.c.y, term.top, term.bot))
 		tscrolldown(term.c.y, n);
 }
=20
 void
 tdeleteline(int n) {
-	if(BETWEEN(term.c.y, term.top, term.bot))
+	if (BETWEEN(term.c.y, term.top, term.bot))
 		tscrollup(term.c.y, n);
 }
=20
_AT_@ -1758,29 +1764,28 @@ tdefcolor(int *attr, int *npar, int l) {
 	case 2: /* direct color in RGB space */
 		if (*npar + 4 >=3D l) {
 			fprintf(stderr,
-				"erresc(38): Incorrect number of parameters (%d)\n",
-				*npar);
+			        "erresc(38): Incorrect number of parameters (%d)\n",
+			        *npar);
 			break;
 		}
 		r =3D attr[*npar + 2];
 		g =3D attr[*npar + 3];
 		b =3D attr[*npar + 4];
 		*npar +=3D 4;
-		if(!BETWEEN(r, 0, 255) || !BETWEEN(g, 0, 255) || !BETWEEN(b, 0, 255))
-			fprintf(stderr, "erresc: bad rgb color (%u,%u,%u)\n",
-				r, g, b);
+		if (!BETWEEN(r, 0, 255) || !BETWEEN(g, 0, 255) || !BETWEEN(b, 0, 255))
+			fprintf(stderr, "erresc: bad rgb color (%u,%u,%u)\n", r, g, b);
 		else
 			idx =3D TRUECOLOR(r, g, b);
 		break;
 	case 5: /* indexed color */
 		if (*npar + 2 >=3D l) {
 			fprintf(stderr,
-				"erresc(38): Incorrect number of parameters (%d)\n",
-				*npar);
+			        "erresc(38): Incorrect number of parameters (%d)\n",
+			        *npar);
 			break;
 		}
 		*npar +=3D 2;
-		if(!BETWEEN(attr[*npar], 0, 255))
+		if (!BETWEEN(attr[*npar], 0, 255))
 			fprintf(stderr, "erresc: bad fgcolor %d\n", attr[*npar]);
 		else
 			idx =3D attr[*npar];
_AT_@ -1800,11 +1805,11 @@ tdefcolor(int *attr, int *npar, int l) {
=20
 void
 tsetattr(int *attr, int l) {
-	int i;
 	int32_t idx;
+	int i;
=20
-	for(i =3D 0; i < l; i++) {
-		switch(attr[i]) {
+	for (i =3D 0; i < l; i++) {
+		switch (attr[i]) {
 		case 0:
 			term.c.attr.mode &=3D ~(
 				ATTR_BOLD       |
_AT_@ -1880,18 +1885,18 @@ tsetattr(int *attr, int l) {
 			term.c.attr.bg =3D defaultbg;
 			break;
 		default:
-			if(BETWEEN(attr[i], 30, 37)) {
+			if (BETWEEN(attr[i], 30, 37)) {
 				term.c.attr.fg =3D attr[i] - 30;
-			} else if(BETWEEN(attr[i], 40, 47)) {
+			} else if (BETWEEN(attr[i], 40, 47)) {
 				term.c.attr.bg =3D attr[i] - 40;
-			} else if(BETWEEN(attr[i], 90, 97)) {
+			} else if (BETWEEN(attr[i], 90, 97)) {
 				term.c.attr.fg =3D attr[i] - 90 + 8;
-			} else if(BETWEEN(attr[i], 100, 107)) {
+			} else if (BETWEEN(attr[i], 100, 107)) {
 				term.c.attr.bg =3D attr[i] - 100 + 8;
 			} else {
 				fprintf(stderr,
-					"erresc(default): gfx attr %d unknown\n",
-					attr[i]), csidump();
+				        "erresc(default): gfx attr %d unknown\n",
+				        attr[i]), csidump();
 			}
 			break;
 		}
_AT_@ -1902,9 +1907,9 @@ void
 tsetscroll(int t, int b) {
 	int temp;
=20
-	LIMIT(t, 0, term.row-1);
-	LIMIT(b, 0, term.row-1);
-	if(t > b) {
+	LIMIT(t, 0, term.row - 1);
+	LIMIT(b, 0, term.row - 1);
+	if (t > b) {
 		temp =3D t;
 		t =3D b;
 		b =3D temp;
_AT_@ -1918,16 +1923,16 @@ tsetmode(int priv, int set, int *args, int narg) {
 	int *lim, mode;
 	int alt;
=20
-	for(lim =3D args + narg; args < lim; ++args) {
-		if(priv) {
-			switch(*args) {
+	for (lim =3D args + narg; args < lim; ++args) {
+		if (priv) {
+			switch (*args) {
 			case 1: /* DECCKM -- Cursor key */
 				MODBIT(term.mode, set, MODE_APPCURSOR);
 				break;
 			case 5: /* DECSCNM -- Reverse video */
 				mode =3D term.mode;
 				MODBIT(term.mode, set, MODE_REVERSE);
-				if(mode !=3D term.mode)
+				if (mode !=3D term.mode)
 					redraw();
 				break;
 			case 6: /* DECOM -- Origin */
_AT_@ -1989,13 +1994,12 @@ tsetmode(int priv, int set, int *args, int narg) {
 				if (!allowaltscreen)
 					break;
 				alt =3D IS_SET(MODE_ALTSCREEN);
-				if(alt) {
-					tclearregion(0, 0, term.col-1,
-							term.row-1);
+				if (alt) {
+					tclearregion(0, 0, term.col - 1, term.row - 1);
 				}
-				if(set ^ alt) /* set is always 1 or 0 */
+				if (set ^ alt) /* set is always 1 or 0 */
 					tswapscreen();
-				if(*args !=3D 1049)
+				if (*args !=3D 1049)
 					break;
 				/* FALLTHROUGH */
 			case 1048:
_AT_@ -2015,12 +2019,12 @@ tsetmode(int priv, int set, int *args, int narg) {
 				      codes. */
 			default:
 				fprintf(stderr,
-					"erresc: unknown private set/reset mode %d\n",
-					*args);
+				        "erresc: unknown private set/reset mode %d\n",
+				        *args);
 				break;
 			}
 		} else {
-			switch(*args) {
+			switch (*args) {
 			case 0:  /* Error (IGNORED) */
 				break;
 			case 2:  /* KAM -- keyboard action */
_AT_@ -2037,8 +2041,8 @@ tsetmode(int priv, int set, int *args, int narg) {
 				break;
 			default:
 				fprintf(stderr,
-					"erresc: unknown set/reset mode %d\n",
-					*args);
+				        "erresc: unknown set/reset mode %d\n",
+				        *args);
 				break;
 			}
 		}
_AT_@ -2047,10 +2051,10 @@ tsetmode(int priv, int set, int *args, int narg) {
=20
 void
 csihandle(void) {
-	char buf[40];
 	int len;
+	char buf[40];
=20
-	switch(csiescseq.mode[0]) {
+	switch (csiescseq.mode[0]) {
 	default:
 	unknown:
 		fprintf(stderr, "erresc: unknown csi ");
_AT_@ -2063,15 +2067,15 @@ csihandle(void) {
 		break;
 	case 'A': /* CUU -- Cursor <n> Up */
 		DEFAULT(csiescseq.arg[0], 1);
-		tmoveto(term.c.x, term.c.y-csiescseq.arg[0]);
+		tmoveto(term.c.x, term.c.y - csiescseq.arg[0]);
 		break;
 	case 'B': /* CUD -- Cursor <n> Down */
 	case 'e': /* VPR --Cursor <n> Down */
 		DEFAULT(csiescseq.arg[0], 1);
-		tmoveto(term.c.x, term.c.y+csiescseq.arg[0]);
+		tmoveto(term.c.x, term.c.y + csiescseq.arg[0]);
 		break;
 	case 'i': /* MC -- Media Copy */
-		switch(csiescseq.arg[0]) {
+		switch (csiescseq.arg[0]) {
 		case 0:
 			tdump();
 			break;
_AT_@ -2090,28 +2094,28 @@ csihandle(void) {
 		}
 		break;
 	case 'c': /* DA -- Device Attributes */
-		if(csiescseq.arg[0] =3D=3D 0)
+		if (csiescseq.arg[0] =3D=3D 0)
 			ttywrite(vtiden, sizeof(vtiden) - 1);
 		break;
 	case 'C': /* CUF -- Cursor <n> Forward */
 	case 'a': /* HPR -- Cursor <n> Forward */
 		DEFAULT(csiescseq.arg[0], 1);
-		tmoveto(term.c.x+csiescseq.arg[0], term.c.y);
+		tmoveto(term.c.x + csiescseq.arg[0], term.c.y);
 		break;
 	case 'D': /* CUB -- Cursor <n> Backward */
 		DEFAULT(csiescseq.arg[0], 1);
-		tmoveto(term.c.x-csiescseq.arg[0], term.c.y);
+		tmoveto(term.c.x - csiescseq.arg[0], term.c.y);
 		break;
 	case 'E': /* CNL -- Cursor <n> Down and first col */
 		DEFAULT(csiescseq.arg[0], 1);
-		tmoveto(0, term.c.y+csiescseq.arg[0]);
+		tmoveto(0, term.c.y + csiescseq.arg[0]);
 		break;
 	case 'F': /* CPL -- Cursor <n> Up and first col */
 		DEFAULT(csiescseq.arg[0], 1);
-		tmoveto(0, term.c.y-csiescseq.arg[0]);
+		tmoveto(0, term.c.y - csiescseq.arg[0]);
 		break;
 	case 'g': /* TBC -- Tabulation clear */
-		switch(csiescseq.arg[0]) {
+		switch (csiescseq.arg[0]) {
 		case 0: /* clear current tab stop */
 			term.tabs[term.c.x] =3D 0;
 			break;
_AT_@ -2125,13 +2129,13 @@ csihandle(void) {
 	case 'G': /* CHA -- Move to <col> */
 	case '`': /* HPA */
 		DEFAULT(csiescseq.arg[0], 1);
-		tmoveto(csiescseq.arg[0]-1, term.c.y);
+		tmoveto(csiescseq.arg[0] - 1, term.c.y);
 		break;
 	case 'H': /* CUP -- Move to <row> <col> */
 	case 'f': /* HVP */
 		DEFAULT(csiescseq.arg[0], 1);
 		DEFAULT(csiescseq.arg[1], 1);
-		tmoveato(csiescseq.arg[1]-1, csiescseq.arg[0]-1);
+		tmoveato(csiescseq.arg[1] - 1, csiescseq.arg[0] - 1);
 		break;
 	case 'I': /* CHT -- Cursor Forward Tabulation <n> tab stops */
 		DEFAULT(csiescseq.arg[0], 1);
_AT_@ -2139,37 +2143,35 @@ csihandle(void) {
 		break;
 	case 'J': /* ED -- Clear screen */
 		selclear(NULL);
-		switch(csiescseq.arg[0]) {
+		switch (csiescseq.arg[0]) {
 		case 0: /* below */
-			tclearregion(term.c.x, term.c.y, term.col-1, term.c.y);
-			if(term.c.y < term.row-1) {
-				tclearregion(0, term.c.y+1, term.col-1,
-						term.row-1);
+			tclearregion(term.c.x, term.c.y, term.col - 1, term.c.y);
+			if (term.c.y < term.row - 1) {
+				tclearregion(0, term.c.y + 1, term.col - 1, term.row - 1);
 			}
 			break;
 		case 1: /* above */
-			if(term.c.y > 1)
-				tclearregion(0, 0, term.col-1, term.c.y-1);
+			if (term.c.y > 1)
+				tclearregion(0, 0, term.col - 1, term.c.y - 1);
 			tclearregion(0, term.c.y, term.c.x, term.c.y);
 			break;
 		case 2: /* all */
-			tclearregion(0, 0, term.col-1, term.row-1);
+			tclearregion(0, 0, term.col - 1, term.row - 1);
 			break;
 		default:
 			goto unknown;
 		}
 		break;
 	case 'K': /* EL -- Clear line */
-		switch(csiescseq.arg[0]) {
+		switch (csiescseq.arg[0]) {
 		case 0: /* right */
-			tclearregion(term.c.x, term.c.y, term.col-1,
-					term.c.y);
+			tclearregion(term.c.x, term.c.y, term.col - 1, term.c.y);
 			break;
 		case 1: /* left */
 			tclearregion(0, term.c.y, term.c.x, term.c.y);
 			break;
 		case 2: /* all */
-			tclearregion(0, term.c.y, term.col-1, term.c.y);
+			tclearregion(0, term.c.y, term.col - 1, term.c.y);
 			break;
 		}
 		break;
_AT_@ -2195,7 +2197,7 @@ csihandle(void) {
 	case 'X': /* ECH -- Erase <n> char */
 		DEFAULT(csiescseq.arg[0], 1);
 		tclearregion(term.c.x, term.c.y,
-				term.c.x + csiescseq.arg[0] - 1, term.c.y);
+		             term.c.x + csiescseq.arg[0] - 1, term.c.y);
 		break;
 	case 'P': /* DCH -- Delete <n> char */
 		DEFAULT(csiescseq.arg[0], 1);
_AT_@ -2207,7 +2209,7 @@ csihandle(void) {
 		break;
 	case 'd': /* VPA -- Move to <row> */
 		DEFAULT(csiescseq.arg[0], 1);
-		tmoveato(term.c.x, csiescseq.arg[0]-1);
+		tmoveato(term.c.x, csiescseq.arg[0] - 1);
 		break;
 	case 'h': /* SM -- Set terminal mode */
 		tsetmode(csiescseq.priv, 1, csiescseq.arg, csiescseq.narg);
_AT_@ -2218,17 +2220,17 @@ csihandle(void) {
 	case 'n': /* DSR =E2=80=93 Device Status Report (cursor position) */
 		if (csiescseq.arg[0] =3D=3D 6) {
 			len =3D snprintf(buf, sizeof(buf),"\033[%i;%iR",
-					term.c.y+1, term.c.x+1);
+			               term.c.y + 1, term.c.x + 1);
 			ttywrite(buf, len);
 		}
 		break;
 	case 'r': /* DECSTBM -- Set Scrolling Region */
-		if(csiescseq.priv) {
+		if (csiescseq.priv) {
 			goto unknown;
 		} else {
 			DEFAULT(csiescseq.arg[0], 1);
 			DEFAULT(csiescseq.arg[1], term.row);
-			tsetscroll(csiescseq.arg[0]-1, csiescseq.arg[1]-1);
+			tsetscroll(csiescseq.arg[0] - 1, csiescseq.arg[1] - 1);
 			tmoveato(0, 0);
 		}
 		break;
_AT_@ -2256,19 +2258,19 @@ csihandle(void) {
=20
 void
 csidump(void) {
-	int i;
 	uint c;
+	int i;
=20
 	printf("ESC[");
-	for(i =3D 0; i < csiescseq.len; i++) {
+	for (i =3D 0; i < csiescseq.len; i++) {
 		c =3D csiescseq.buf[i] & 0xff;
-		if(isprint(c)) {
+		if (isprint(c)) {
 			putchar(c);
-		} else if(c =3D=3D '\n') {
+		} else if (c =3D=3D '\n') {
 			printf("(\\n)");
-		} else if(c =3D=3D '\r') {
+		} else if (c =3D=3D '\r') {
 			printf("(\\r)");
-		} else if(c =3D=3D 0x1b) {
+		} else if (c =3D=3D 0x1b) {
 			printf("(\\e)");
 		} else {
 			printf("(%02x)", c);
_AT_@ -2284,30 +2286,30 @@ csireset(void) {
=20
 void
 strhandle(void) {
-	char *p =3D NULL;
 	int j, narg, par;
+	char *p =3D NULL;
=20
 	term.esc &=3D ~(ESC_STR_END|ESC_STR);
 	strparse();
 	par =3D (narg =3D strescseq.narg) ? atoi(strescseq.args[0]) : 0;
=20
-	switch(strescseq.type) {
+	switch (strescseq.type) {
 	case ']': /* OSC -- Operating System Command */
-		switch(par) {
+		switch (par) {
 		case 0:
 		case 1:
 		case 2:
-			if(narg > 1)
+			if (narg > 1)
 				xsettitle(strescseq.args[1]);
 			return;
 		case 4: /* color set */
-			if(narg < 3)
+			if (narg < 3)
 				break;
 			p =3D strescseq.args[2];
 			/* FALLTHROUGH */
 		case 104: /* color reset, here p =3D NULL */
 			j =3D (narg > 1) ? atoi(strescseq.args[1]) : -1;
-			if(xsetcolorname(j, p)) {
+			if (xsetcolorname(j, p)) {
 				fprintf(stderr, "erresc: invalid color %s\n", p);
 			} else {
 				/*
_AT_@ -2340,14 +2342,14 @@ strparse(void) {
 	strescseq.narg =3D 0;
 	strescseq.buf[strescseq.len] =3D '\0';
=20
-	if(*p =3D=3D '\0')
+	if (*p =3D=3D '\0')
 		return;
=20
-	while(strescseq.narg < STR_ARG_SIZ) {
+	while (strescseq.narg < STR_ARG_SIZ) {
 		strescseq.args[strescseq.narg++] =3D p;
-		while((c =3D *p) !=3D ';' && c !=3D '\0')
+		while ((c =3D *p) !=3D ';' && c !=3D '\0')
 			++p;
-		if(c =3D=3D '\0')
+		if (c =3D=3D '\0')
 			return;
 		*p++ =3D '\0';
 	}
_AT_@ -2355,21 +2357,21 @@ strparse(void) {
=20
 void
 strdump(void) {
-	int i;
 	uint c;
+	int i;
=20
 	printf("ESC%c", strescseq.type);
-	for(i =3D 0; i < strescseq.len; i++) {
+	for (i =3D 0; i < strescseq.len; i++) {
 		c =3D strescseq.buf[i] & 0xff;
-		if(c =3D=3D '\0') {
+		if (c =3D=3D '\0') {
 			return;
-		} else if(isprint(c)) {
+		} else if (isprint(c)) {
 			putchar(c);
-		} else if(c =3D=3D '\n') {
+		} else if (c =3D=3D '\n') {
 			printf("(\\n)");
-		} else if(c =3D=3D '\r') {
+		} else if (c =3D=3D '\r') {
 			printf("(\\r)");
-		} else if(c =3D=3D 0x1b) {
+		} else if (c =3D=3D 0x1b) {
 			printf("(\\e)");
 		} else {
 			printf("(%02x)", c);
_AT_@ -2385,9 +2387,9 @@ strreset(void) {
=20
 void
 tprinter(char *s, size_t len) {
-	if(iofd !=3D -1 && xwrite(iofd, s, len) < 0) {
+	if (iofd !=3D -1 && xwrite(iofd, s, len) < 0) {
 		fprintf(stderr, "Error writing in %s:%s\n",
-			opt_io, strerror(errno));
+		        opt_io, strerror(errno));
 		close(iofd);
 		iofd =3D -1;
 	}
_AT_@ -2412,7 +2414,7 @@ void
 tdumpsel(void) {
 	char *ptr;
=20
-	if((ptr =3D getsel())) {
+	if ((ptr =3D getsel())) {
 		tprinter(ptr, strlen(ptr));
 		free(ptr);
 	}
_AT_@ -2420,13 +2422,13 @@ tdumpsel(void) {
=20
 void
 tdumpline(int n) {
-	char buf[UTF_SIZ];
 	Glyph *bp, *end;
+	char buf[UTF_SIZ];
=20
 	bp =3D &term.line[n][0];
 	end =3D &bp[MIN(tlinelen(n), term.col) - 1];
-	if(bp !=3D end || bp->u !=3D ' ') {
-		for( ;bp <=3D end; ++bp)
+	if (bp !=3D end || bp->u !=3D ' ') {
+		for ( ;bp <=3D end; ++bp)
 			tprinter(buf, utf8encode(bp->u, buf));
 	}
 	tprinter("\n", 1);
_AT_@ -2436,7 +2438,7 @@ void
 tdump(void) {
 	int i;
=20
-	for(i =3D 0; i < term.row; ++i)
+	for (i =3D 0; i < term.row; ++i)
 		tdumpline(i);
 }
=20
_AT_@ -2444,26 +2446,26 @@ void
 tputtab(int n) {
 	uint x =3D term.c.x;
=20
-	if(n > 0) {
-		while(x < term.col && n--)
-			for(++x; x < term.col && !term.tabs[x]; ++x)
-				/* nothing */ ;
-	} else if(n < 0) {
-		while(x > 0 && n++)
-			for(--x; x > 0 && !term.tabs[x]; --x)
-				/* nothing */ ;
+	if (n > 0) {
+		while (x < term.col && n--)
+			for (++x; x < term.col && !term.tabs[x]; ++x)
+				;
+	} else if (n < 0) {
+		while (x > 0 && n++)
+			for (--x; x > 0 && !term.tabs[x]; --x)
+				;
 	}
-	term.c.x =3D LIMIT(x, 0, term.col-1);
+	term.c.x =3D LIMIT(x, 0, term.col - 1);
 }
=20
 void
 techo(Rune u) {
-	if(ISCONTROL(u)) { /* control code */
-		if(u & 0x80) {
+	if (ISCONTROL(u)) { /* control code */
+		if (u & 0x80) {
 			u &=3D 0x7f;
 			tputc('^');
 			tputc('[');
-		} else if(u !=3D '\n' && u !=3D '\r' && u !=3D '\t') {
+		} else if (u !=3D '\n' && u !=3D '\r' && u !=3D '\t') {
 			u ^=3D 0x40;
 			tputc('^');
 		}
_AT_@ -2473,11 +2475,11 @@ techo(Rune u) {
=20
 void
 tdeftran(char ascii) {
+	static int vcs[] =3D { CS_GRAPHIC0, CS_USA };
 	static char cs[] =3D "0B";
-	static int vcs[] =3D {CS_GRAPHIC0, CS_USA};
 	char *p;
=20
-	if((p =3D strchr(cs, ascii)) =3D=3D NULL) {
+	if (!(p =3D strchr(cs, ascii))) {
 		fprintf(stderr, "esc unhandled charset: ESC ( %c\n", ascii);
 	} else {
 		term.trantbl[term.icharset] =3D vcs[p - cs];
_AT_@ -2488,9 +2490,9 @@ void
 tdectest(char c) {
 	int x, y;
=20
-	if(c =3D=3D '8') { /* DEC screen alignment test. */
-		for(x =3D 0; x < term.col; ++x) {
-			for(y =3D 0; y < term.row; ++y)
+	if (c =3D=3D '8') { /* DEC screen alignment test. */
+		for (x =3D 0; x < term.col; ++x) {
+			for (y =3D 0; y < term.row; ++y)
 				tsetchar('E', &term.c.attr, x, y);
 		}
 	}
_AT_@ -2519,12 +2521,12 @@ tstrsequence(uchar c) {
=20
 void
 tcontrolcode(uchar ascii) {
-	switch(ascii) {
+	switch (ascii) {
 	case '\t':   /* HT */
 		tputtab(1);
 		return;
 	case '\b':   /* BS */
-		tmoveto(term.c.x-1, term.c.y);
+		tmoveto(term.c.x - 1, term.c.y);
 		return;
 	case '\r':   /* CR */
 		tmoveto(0, term.c.y);
_AT_@ -2536,11 +2538,11 @@ tcontrolcode(uchar ascii) {
 		tnewline(IS_SET(MODE_CRLF));
 		return;
 	case '\a':   /* BEL */
-		if(term.esc & ESC_STR_END) {
+		if (term.esc & ESC_STR_END) {
 			/* backwards compatibility to xterm */
 			strhandle();
 		} else {
-			if(!(xw.state & WIN_FOCUSED))
+			if (!(xw.state & WIN_FOCUSED))
 				xseturgency(1);
 			if (bellvolume)
 				XkbBell(xw.dpy, xw.win, bellvolume, (Atom)NULL);
_AT_@ -2602,7 +2604,7 @@ tcontrolcode(uchar ascii) {
  */
 int
 eschandle(uchar ascii) {
-	switch(ascii) {
+	switch (ascii) {
 	case '[':
 		term.esc |=3D ESC_CSI;
 		return 0;
_AT_@ -2628,10 +2630,10 @@ eschandle(uchar ascii) {
 		term.esc |=3D ESC_ALTCHARSET;
 		return 0;
 	case 'D': /* IND -- Linefeed */
-		if(term.c.y =3D=3D term.bot) {
+		if (term.c.y =3D=3D term.bot) {
 			tscrollup(term.top, 1);
 		} else {
-			tmoveto(term.c.x, term.c.y+1);
+			tmoveto(term.c.x, term.c.y + 1);
 		}
 		break;
 	case 'E': /* NEL -- Next line */
_AT_@ -2641,10 +2643,10 @@ eschandle(uchar ascii) {
 		term.tabs[term.c.x] =3D 1;
 		break;
 	case 'M': /* RI -- Reverse index */
-		if(term.c.y =3D=3D term.top) {
+		if (term.c.y =3D=3D term.top) {
 			tscrolldown(term.top, 1);
 		} else {
-			tmoveto(term.c.x, term.c.y-1);
+			tmoveto(term.c.x, term.c.y - 1);
 		}
 		break;
 	case 'Z': /* DECID -- Identify Terminal */
_AT_@ -2668,7 +2670,7 @@ eschandle(uchar ascii) {
 		tcursor(CURSOR_LOAD);
 		break;
 	case '\\': /* ST -- String Terminator */
-		if(term.esc & ESC_STR_END)
+		if (term.esc & ESC_STR_END)
 			strhandle();
 		break;
 	default:
_AT_@ -2681,18 +2683,18 @@ eschandle(uchar ascii) {
=20
 void
 tputc(Rune u) {
-	char c[UTF_SIZ];
+	Glyph *gp;
 	int control;
 	int width, len;
-	Glyph *gp;
+	char c[UTF_SIZ];
=20
 	len =3D utf8encode(u, c);
-	if((width =3D wcwidth(u)) =3D=3D -1) {
+	if ((width =3D wcwidth(u)) =3D=3D -1) {
 		memcpy(c, "\357\277\275", 4); /* UTF_INVALID */
 		width =3D 1;
 	}
=20
-	if(IS_SET(MODE_PRINT))
+	if (IS_SET(MODE_PRINT))
 		tprinter(c, len);
 	control =3D ISCONTROL(u);
=20
_AT_@ -2702,12 +2704,12 @@ tputc(Rune u) {
 	 * receives a ESC, a SUB, a ST or any other C1 control
 	 * character.
 	 */
-	if(term.esc & ESC_STR) {
-		if(u =3D=3D '\a' || u =3D=3D 030 || u =3D=3D 032 || u =3D=3D 033 ||
+	if (term.esc & ESC_STR) {
+		if (u =3D=3D '\a' || u =3D=3D 030 || u =3D=3D 032 || u =3D=3D 033 ||
 		   ISCONTROLC1(u)) {
 			term.esc &=3D ~(ESC_START|ESC_STR);
 			term.esc |=3D ESC_STR_END;
-		} else if(strescseq.len + len < sizeof(strescseq.buf) - 1) {
+		} else if (strescseq.len + len < sizeof(strescseq.buf) - 1) {
 			memmove(&strescseq.buf[strescseq.len], c, len);
 			strescseq.len +=3D len;
 			return;
_AT_@ -2734,26 +2736,25 @@ tputc(Rune u) {
 	 * because they can be embedded inside a control sequence, and
 	 * they must not cause conflicts with sequences.
 	 */
-	if(control) {
+	if (control) {
 		tcontrolcode(u);
 		/*
 		 * control codes are not shown ever
 		 */
 		return;
-	} else if(term.esc & ESC_START) {
-		if(term.esc & ESC_CSI) {
+	} else if (term.esc & ESC_START) {
+		if (term.esc & ESC_CSI) {
 			csiescseq.buf[csiescseq.len++] =3D u;
-			if(BETWEEN(u, 0x40, 0x7E)
-					|| csiescseq.len >=3D \
-					sizeof(csiescseq.buf)-1) {
+			if (BETWEEN(u, 0x40, 0x7E) ||
+			    csiescseq.len >=3D sizeof(csiescseq.buf) - 1) {
 				term.esc =3D 0;
 				csiparse();
 				csihandle();
 			}
 			return;
-		} else if(term.esc & ESC_ALTCHARSET) {
+		} else if (term.esc & ESC_ALTCHARSET) {
 			tdeftran(u);
-		} else if(term.esc & ESC_TEST) {
+		} else if (term.esc & ESC_TEST) {
 			tdectest(u);
 		} else {
 			if (!eschandle(u))
_AT_@ -2767,35 +2768,35 @@ tputc(Rune u) {
 		 */
 		return;
 	}
-	if(sel.ob.x !=3D -1 && BETWEEN(term.c.y, sel.ob.y, sel.oe.y))
+	if (sel.ob.x !=3D -1 && BETWEEN(term.c.y, sel.ob.y, sel.oe.y))
 		selclear(NULL);
=20
 	gp =3D &term.line[term.c.y][term.c.x];
-	if(IS_SET(MODE_WRAP) && (term.c.state & CURSOR_WRAPNEXT)) {
+	if (IS_SET(MODE_WRAP) && (term.c.state & CURSOR_WRAPNEXT)) {
 		gp->mode |=3D ATTR_WRAP;
 		tnewline(1);
 		gp =3D &term.line[term.c.y][term.c.x];
 	}
=20
-	if(IS_SET(MODE_INSERT) && term.c.x+width < term.col)
+	if (IS_SET(MODE_INSERT) && term.c.x+width < term.col)
 		memmove(gp+width, gp, (term.col - term.c.x - width) * sizeof(Glyph));
=20
-	if(term.c.x+width > term.col) {
+	if (term.c.x+width > term.col) {
 		tnewline(1);
 		gp =3D &term.line[term.c.y][term.c.x];
 	}
=20
 	tsetchar(u, &term.c.attr, term.c.x, term.c.y);
=20
-	if(width =3D=3D 2) {
+	if (width =3D=3D 2) {
 		gp->mode |=3D ATTR_WIDE;
-		if(term.c.x+1 < term.col) {
+		if (term.c.x + 1 < term.col) {
 			gp[1].u =3D '\0';
 			gp[1].mode =3D ATTR_WDUMMY;
 		}
 	}
-	if(term.c.x+width < term.col) {
-		tmoveto(term.c.x+width, term.c.y);
+	if (term.c.x + width < term.col) {
+		tmoveto(term.c.x + width, term.c.y);
 	} else {
 		term.c.state |=3D CURSOR_WRAPNEXT;
 	}
_AT_@ -2803,15 +2804,14 @@ tputc(Rune u) {
=20
 void
 tresize(int col, int row) {
+	TCursor c;
 	int i;
 	int minrow =3D MIN(row, term.row);
 	int mincol =3D MIN(col, term.col);
 	int *bp;
-	TCursor c;
=20
-	if(col < 1 || row < 1) {
-		fprintf(stderr,
-		        "tresize: error resizing to %dx%d\n", col, row);
+	if (col < 1 || row < 1) {
+		fprintf(stderr, "tresize: error resizing to %dx%d\n", col, row);
 		return;
 	}
=20
_AT_@ -2820,7 +2820,7 @@ tresize(int col, int row) {
 	 * tscrollup would work here, but we can optimize to
 	 * memmove because we're freeing the earlier lines
 	 */
-	for(i =3D 0; i <=3D term.c.y - row; i++) {
+	for (i =3D 0; i <=3D term.c.y - row; i++) {
 		free(term.line[i]);
 		free(term.alt[i]);
 	}
_AT_@ -2829,7 +2829,7 @@ tresize(int col, int row) {
 		memmove(term.line, term.line + i, row * sizeof(Line));
 		memmove(term.alt, term.alt + i, row * sizeof(Line));
 	}
-	for(i +=3D row; i < term.row; i++) {
+	for (i +=3D row; i < term.row; i++) {
 		free(term.line[i]);
 		free(term.alt[i]);
 	}
_AT_@ -2838,45 +2838,45 @@ tresize(int col, int row) {
 	term.specbuf =3D xrealloc(term.specbuf, col * sizeof(XftGlyphFontSpec));
=20
 	/* resize to new height */
-	term.line =3D xrealloc(term.line, row * sizeof(Line));
-	term.alt  =3D xrealloc(term.alt,  row * sizeof(Line));
+	term.line  =3D xrealloc(term.line,  row * sizeof(Line));
+	term.alt   =3D xrealloc(term.alt,   row * sizeof(Line));
 	term.dirty =3D xrealloc(term.dirty, row * sizeof(*term.dirty));
-	term.tabs =3D xrealloc(term.tabs, col * sizeof(*term.tabs));
+	term.tabs  =3D xrealloc(term.tabs,  col * sizeof(*term.tabs));
=20
 	/* resize each row to new width, zero-pad if needed */
-	for(i =3D 0; i < minrow; i++) {
+	for (i =3D 0; i < minrow; i++) {
 		term.line[i] =3D xrealloc(term.line[i], col * sizeof(Glyph));
 		term.alt[i]  =3D xrealloc(term.alt[i],  col * sizeof(Glyph));
 	}
=20
 	/* allocate any new rows */
-	for(/* i =3D=3D minrow */; i < row; i++) {
+	for (/* i =3D=3D minrow */; i < row; i++) {
 		term.line[i] =3D xmalloc(col * sizeof(Glyph));
 		term.alt[i] =3D xmalloc(col * sizeof(Glyph));
 	}
-	if(col > term.col) {
+	if (col > term.col) {
 		bp =3D term.tabs + term.col;
=20
 		memset(bp, 0, sizeof(*term.tabs) * (col - term.col));
-		while(--bp > term.tabs && !*bp)
+		while (--bp > term.tabs && !*bp)
 			/* nothing */ ;
-		for(bp +=3D tabspaces; bp < term.tabs + col; bp +=3D tabspaces)
+		for (bp +=3D tabspaces; bp < term.tabs + col; bp +=3D tabspaces)
 			*bp =3D 1;
 	}
 	/* update terminal size */
 	term.col =3D col;
 	term.row =3D row;
 	/* reset scrolling region */
-	tsetscroll(0, row-1);
+	tsetscroll(0, row - 1);
 	/* make use of the LIMIT in tmoveto */
 	tmoveto(term.c.x, term.c.y);
 	/* Clearing both screens (it makes dirty all lines) */
 	c =3D term.c;
-	for(i =3D 0; i < 2; i++) {
-		if(mincol < col && 0 < minrow) {
+	for (i =3D 0; i < 2; i++) {
+		if (mincol < col && 0 < minrow) {
 			tclearregion(mincol, 0, col - 1, minrow - 1);
 		}
-		if(0 < col && minrow < row) {
+		if (0 < col && minrow < row) {
 			tclearregion(0, minrow, col - 1, row - 1);
 		}
 		tswapscreen();
_AT_@ -2892,52 +2892,52 @@ xresize(int col, int row) {
=20
 	XFreePixmap(xw.dpy, xw.buf);
 	xw.buf =3D XCreatePixmap(xw.dpy, xw.win, xw.w, xw.h,
-			DefaultDepth(xw.dpy, xw.scr));
+	                       DefaultDepth(xw.dpy, xw.scr));
 	XftDrawChange(xw.draw, xw.buf);
 	xclear(0, 0, xw.w, xw.h);
 }
=20
 ushort
 sixd_to_16bit(int x) {
-	return x =3D=3D 0 ? 0 : 0x3737 + 0x2828 * x;
+	return x ? 0x3737 + 0x2828 * x : 0;
 }
=20
 int
 xloadcolor(int i, const char *name, Color *ncolor) {
 	XRenderColor color =3D { .alpha =3D 0xffff };
=20
-	if(!name) {
-		if(BETWEEN(i, 16, 255)) { /* 256 color */
-			if(i < 6*6*6+16) { /* same colors as xterm */
-				color.red   =3D sixd_to_16bit( ((i-16)/36)%6 );
-				color.green =3D sixd_to_16bit( ((i-16)/6) %6 );
-				color.blue  =3D sixd_to_16bit( ((i-16)/1) %6 );
+	if (!name) {
+		if (BETWEEN(i, 16, 255)) { /* 256 color */
+			if (i < 6 * 6 * 6 + 16) { /* same colors as xterm */
+				color.red   =3D sixd_to_16bit( ((i - 16) / 36) % 6 );
+				color.green =3D sixd_to_16bit( ((i - 16) / 6)  % 6 );
+				color.blue  =3D sixd_to_16bit( ((i - 16) / 1)  % 6 );
 			} else { /* greyscale */
-				color.red =3D 0x0808 + 0x0a0a * (i - (6*6*6+16));
+				color.red =3D 0x0808 + 0x0a0a * (i - (6 * 6 * 6 + 16));
 				color.green =3D color.blue =3D color.red;
 			}
-			return XftColorAllocValue(xw.dpy, xw.vis,
-			                          xw.cmap, &color, ncolor);
+			return XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &color, ncolor);
 		} else
 			name =3D colorname[i];
 	}
+
 	return XftColorAllocName(xw.dpy, xw.vis, xw.cmap, name, ncolor);
 }
=20
 void
 xloadcols(void) {
+	Color *cp;
 	int i;
 	static int loaded;
-	Color *cp;
=20
-	if(loaded) {
+	if (loaded) {
 		for (cp =3D dc.col; cp < &dc.col[LEN(dc.col)]; ++cp)
 			XftColorFree(xw.dpy, xw.vis, xw.cmap, cp);
 	}
=20
-	for(i =3D 0; i < LEN(dc.col); i++)
-		if(!xloadcolor(i, NULL, &dc.col[i])) {
-			if(colorname[i])
+	for (i =3D 0; i < LEN(dc.col); i++)
+		if (!xloadcolor(i, NULL, &dc.col[i])) {
+			if (colorname[i])
 				die("Could not allocate color '%s'\n", colorname[i]);
 			else
 				die("Could not allocate color %d\n", i);
_AT_@ -2949,26 +2949,24 @@ int
 xsetcolorname(int x, const char *name) {
 	Color ncolor;
=20
-	if(!BETWEEN(x, 0, LEN(dc.col)))
+	if (!BETWEEN(x, 0, LEN(dc.col)))
 		return 1;
=20
=20
-	if(!xloadcolor(x, name, &ncolor))
+	if (!xloadcolor(x, name, &ncolor))
 		return 1;
=20
 	XftColorFree(xw.dpy, xw.vis, xw.cmap, &dc.col[x]);
 	dc.col[x] =3D ncolor;
+
 	return 0;
 }
=20
 void
 xtermclear(int col1, int row1, int col2, int row2) {
-	XftDrawRect(xw.draw,
-			&dc.col[IS_SET(MODE_REVERSE) ? defaultfg : defaultbg],
-			borderpx + col1 * xw.cw,
-			borderpx + row1 * xw.ch,
-			(col2-col1+1) * xw.cw,
-			(row2-row1+1) * xw.ch);
+	XftDrawRect(xw.draw, &dc.col[IS_SET(MODE_REVERSE) ? defaultfg : defaultbg=
],
+	            borderpx + col1 * xw.cw, borderpx + row1 * xw.ch,
+	            (col2 - col1 + 1) * xw.cw, (row2 - row1 + 1) * xw.ch);
 }
=20
 /*
_AT_@ -2976,46 +2974,44 @@ xtermclear(int col1, int row1, int col2, int row2) {
  */
 void
 xclear(int x1, int y1, int x2, int y2) {
-	XftDrawRect(xw.draw,
-			&dc.col[IS_SET(MODE_REVERSE)? defaultfg : defaultbg],
-			x1, y1, x2-x1, y2-y1);
+	XftDrawRect(xw.draw, &dc.col[IS_SET(MODE_REVERSE)? defaultfg : defaultbg],
+	            x1, y1, x2 - x1, y2 - y1);
 }
=20
 void
 xhints(void) {
-	XClassHint class =3D {opt_class ? opt_class : termname, termname};
-	XWMHints wm =3D {.flags =3D InputHint, .input =3D 1};
+	XClassHint class =3D { opt_class ? opt_class : termname, termname };
 	XSizeHints *sizeh =3D NULL;
+	XWMHints wm =3D { .flags =3D InputHint, .input =3D 1 };
=20
 	sizeh =3D XAllocSizeHints();
=20
-	sizeh->flags =3D PSize | PResizeInc | PBaseSize;
-	sizeh->height =3D xw.h;
-	sizeh->width =3D xw.w;
-	sizeh->height_inc =3D xw.ch;
-	sizeh->width_inc =3D xw.cw;
+	sizeh->flags       =3D PSize | PResizeInc | PBaseSize;
+	sizeh->height      =3D xw.h;
+	sizeh->width       =3D xw.w;
+	sizeh->height_inc  =3D xw.ch;
+	sizeh->width_inc   =3D xw.cw;
 	sizeh->base_height =3D 2 * borderpx;
-	sizeh->base_width =3D 2 * borderpx;
-	if(xw.isfixed =3D=3D True) {
-		sizeh->flags |=3D PMaxSize | PMinSize;
-		sizeh->min_width =3D sizeh->max_width =3D xw.w;
+	sizeh->base_width  =3D 2 * borderpx;
+	if (xw.isfixed) {
+		sizeh->flags     |=3D PMaxSize | PMinSize;
+		sizeh->min_width  =3D sizeh->max_width =3D xw.w;
 		sizeh->min_height =3D sizeh->max_height =3D xw.h;
 	}
-	if(xw.gm & (XValue|YValue)) {
-		sizeh->flags |=3D USPosition | PWinGravity;
-		sizeh->x =3D xw.l;
-		sizeh->y =3D xw.t;
+	if (xw.gm & (XValue|YValue)) {
+		sizeh->flags      |=3D USPosition | PWinGravity;
+		sizeh->x           =3D xw.l;
+		sizeh->y           =3D xw.t;
 		sizeh->win_gravity =3D xgeommasktogravity(xw.gm);
 	}
=20
-	XSetWMProperties(xw.dpy, xw.win, NULL, NULL, NULL, 0, sizeh, &wm,
-			&class);
+	XSetWMProperties(xw.dpy, xw.win, NULL, NULL, NULL, 0, sizeh, &wm, &class);
 	XFree(sizeh);
 }
=20
 int
 xgeommasktogravity(int mask) {
-	switch(mask & (XNegative|YNegative)) {
+	switch (mask & (XNegative | YNegative)) {
 	case 0:
 		return NorthWestGravity;
 	case XNegative:
_AT_@ -3023,6 +3019,7 @@ xgeommasktogravity(int mask) {
 	case YNegative:
 		return SouthWestGravity;
 	}
+
 	return SouthEastGravity;
 }
=20
_AT_@ -3032,24 +3029,24 @@ xloadfont(Font *f, FcPattern *pattern) {
 	FcResult result;
=20
 	match =3D FcFontMatch(NULL, pattern, &result);
-	if(!match)
+	if (!match)
 		return 1;
=20
-	if(!(f->match =3D XftFontOpenPattern(xw.dpy, match))) {
+	if (!(f->match =3D XftFontOpenPattern(xw.dpy, match))) {
 		FcPatternDestroy(match);
 		return 1;
 	}
=20
-	f->set =3D NULL;
+	f->set     =3D NULL;
 	f->pattern =3D FcPatternDuplicate(pattern);
=20
-	f->ascent =3D f->match->ascent;
-	f->descent =3D f->match->descent;
+	f->ascent   =3D f->match->ascent;
+	f->descent  =3D f->match->descent;
 	f->lbearing =3D 0;
 	f->rbearing =3D f->match->max_advance_width;
=20
 	f->height =3D f->ascent + f->descent;
-	f->width =3D f->lbearing + f->rbearing;
+	f->width  =3D f->lbearing + f->rbearing;
=20
 	return 0;
 }
_AT_@ -3060,26 +3057,26 @@ xloadfonts(char *fontstr, double fontsize) {
 	double fontval;
 	float ceilf(float);
=20
-	if(fontstr[0] =3D=3D '-') {
-		pattern =3D XftXlfdParse(fontstr, False, False);
+	if (fontstr[0] =3D=3D '-') {
+		pattern =3D XftXlfdParse(fontstr, 0, 0);
 	} else {
 		pattern =3D FcNameParse((FcChar8 *)fontstr);
 	}
=20
-	if(!pattern)
+	if (!pattern)
 		die("st: can't open font %s\n", fontstr);
=20
-	if(fontsize > 1) {
+	if (fontsize > 1) {
 		FcPatternDel(pattern, FC_PIXEL_SIZE);
 		FcPatternDel(pattern, FC_SIZE);
 		FcPatternAddDouble(pattern, FC_PIXEL_SIZE, (double)fontsize);
 		usedfontsize =3D fontsize;
 	} else {
-		if(FcPatternGetDouble(pattern, FC_PIXEL_SIZE, 0, &fontval) =3D=3D
-				FcResultMatch) {
+		if (FcPatternGetDouble(pattern, FC_PIXEL_SIZE, 0, &fontval) =3D=3D
+		    FcResultMatch) {
 			usedfontsize =3D fontval;
-		} else if(FcPatternGetDouble(pattern, FC_SIZE, 0, &fontval) =3D=3D
-				FcResultMatch) {
+		} else if (FcPatternGetDouble(pattern, FC_SIZE, 0, &fontval) =3D=3D
+		           FcResultMatch) {
 			usedfontsize =3D -1;
 		} else {
 			/*
_AT_@ -3095,14 +3092,14 @@ xloadfonts(char *fontstr, double fontsize) {
 	FcConfigSubstitute(0, pattern, FcMatchPattern);
 	FcDefaultSubstitute(pattern);
=20
-	if(xloadfont(&dc.font, pattern))
+	if (xloadfont(&dc.font, pattern))
 		die("st: can't open font %s\n", fontstr);
=20
-	if(usedfontsize < 0) {
+	if (usedfontsize < 0) {
 		FcPatternGetDouble(dc.font.match->pattern,
 		                   FC_PIXEL_SIZE, 0, &fontval);
 		usedfontsize =3D fontval;
-		if(fontsize =3D=3D 0)
+		if (fontsize =3D=3D 0)
 			defaultfontsize =3D fontval;
 	}
=20
_AT_@ -3112,17 +3109,17 @@ xloadfonts(char *fontstr, double fontsize) {
=20
 	FcPatternDel(pattern, FC_SLANT);
 	FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ITALIC);
-	if(xloadfont(&dc.ifont, pattern))
+	if (xloadfont(&dc.ifont, pattern))
 		die("st: can't open font %s\n", fontstr);
=20
 	FcPatternDel(pattern, FC_WEIGHT);
 	FcPatternAddInteger(pattern, FC_WEIGHT, FC_WEIGHT_BOLD);
-	if(xloadfont(&dc.ibfont, pattern))
+	if (xloadfont(&dc.ibfont, pattern))
 		die("st: can't open font %s\n", fontstr);
=20
 	FcPatternDel(pattern, FC_SLANT);
 	FcPatternAddInteger(pattern, FC_SLANT, FC_SLANT_ROMAN);
-	if(xloadfont(&dc.bfont, pattern))
+	if (xloadfont(&dc.bfont, pattern))
 		die("st: can't open font %s\n", fontstr);
=20
 	FcPatternDestroy(pattern);
_AT_@ -3132,14 +3129,14 @@ void
 xunloadfont(Font *f) {
 	XftFontClose(xw.dpy, f->match);
 	FcPatternDestroy(f->pattern);
-	if(f->set)
+	if (f->set)
 		FcFontSetDestroy(f->set);
 }
=20
 void
 xunloadfonts(void) {
 	/* Free the loaded fonts in the font cache.  */
-	while(frclen > 0)
+	while (frclen > 0)
 		XftFontClose(xw.dpy, frc[--frclen].font);
=20
 	xunloadfont(&dc.font);
_AT_@ -3169,7 +3166,7 @@ void
 xzoomreset(const Arg *arg) {
 	Arg larg;
=20
-	if(defaultfontsize > 0) {
+	if (defaultfontsize > 0) {
 		larg.f =3D defaultfontsize;
 		xzoomabs(&larg);
 	}
_AT_@ -3177,21 +3174,21 @@ xzoomreset(const Arg *arg) {
=20
 void
 xinit(void) {
-	XGCValues gcvalues;
+	pid_t thispid =3D getpid();
 	Cursor cursor;
 	Window parent;
-	pid_t thispid =3D getpid();
+	XGCValues gcvalues;
=20
-	if(!(xw.dpy =3D XOpenDisplay(NULL)))
+	if (!(xw.dpy =3D XOpenDisplay(NULL)))
 		die("Can't open display\n");
 	xw.scr =3D XDefaultScreen(xw.dpy);
 	xw.vis =3D XDefaultVisual(xw.dpy, xw.scr);
=20
 	/* font */
-	if(!FcInit())
+	if (!FcInit())
 		die("Could not init fontconfig.\n");
=20
-	usedfont =3D (opt_font =3D=3D NULL)? font : opt_font;
+	usedfont =3D opt_font ? opt_font : font;
 	xloadfonts(usedfont, 0);
=20
 	/* colors */
_AT_@ -3201,33 +3198,32 @@ xinit(void) {
 	/* adjust fixed window geometry */
 	xw.w =3D 2 * borderpx + term.col * xw.cw;
 	xw.h =3D 2 * borderpx + term.row * xw.ch;
-	if(xw.gm & XNegative)
+	if (xw.gm & XNegative)
 		xw.l +=3D DisplayWidth(xw.dpy, xw.scr) - xw.w - 2;
-	if(xw.gm & YNegative)
+	if (xw.gm & YNegative)
 		xw.t +=3D DisplayWidth(xw.dpy, xw.scr) - xw.h - 2;
=20
 	/* Events */
 	xw.attrs.background_pixel =3D dc.col[defaultbg].pixel;
 	xw.attrs.border_pixel =3D dc.col[defaultbg].pixel;
 	xw.attrs.bit_gravity =3D NorthWestGravity;
-	xw.attrs.event_mask =3D FocusChangeMask | KeyPressMask
-		| ExposureMask | VisibilityChangeMask | StructureNotifyMask
-		| ButtonMotionMask | ButtonPressMask | ButtonReleaseMask;
+	xw.attrs.event_mask =3D FocusChangeMask | KeyPressMask | ExposureMask |
+	                      VisibilityChangeMask | StructureNotifyMask |
+	                      ButtonMotionMask | ButtonPressMask | ButtonReleaseM=
ask;
 	xw.attrs.colormap =3D xw.cmap;
=20
 	if (!(opt_embed && (parent =3D strtol(opt_embed, NULL, 0))))
 		parent =3D XRootWindow(xw.dpy, xw.scr);
 	xw.win =3D XCreateWindow(xw.dpy, parent, xw.l, xw.t,
-			xw.w, xw.h, 0, XDefaultDepth(xw.dpy, xw.scr), InputOutput,
-			xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity
-			| CWEventMask | CWColormap, &xw.attrs);
+	                       xw.w, xw.h, 0, XDefaultDepth(xw.dpy, xw.scr), Inpu=
tOutput,
+	                       xw.vis, CWBackPixel | CWBorderPixel | CWBitGravity=
 |
+	                       CWEventMask | CWColormap, &xw.attrs);
=20
 	memset(&gcvalues, 0, sizeof(gcvalues));
-	gcvalues.graphics_exposures =3D False;
-	dc.gc =3D XCreateGC(xw.dpy, parent, GCGraphicsExposures,
-			&gcvalues);
+	gcvalues.graphics_exposures =3D 0;
+	dc.gc =3D XCreateGC(xw.dpy, parent, GCGraphicsExposures, &gcvalues);
 	xw.buf =3D XCreatePixmap(xw.dpy, xw.win, xw.w, xw.h,
-			DefaultDepth(xw.dpy, xw.scr));
+	                       DefaultDepth(xw.dpy, xw.scr));
 	XSetForeground(xw.dpy, dc.gc, dc.col[defaultbg].pixel);
 	XFillRectangle(xw.dpy, xw.buf, dc.gc, 0, 0, xw.w, xw.h);
=20
_AT_@ -3235,83 +3231,80 @@ xinit(void) {
 	xw.draw =3D XftDrawCreate(xw.dpy, xw.buf, xw.vis, xw.cmap);
=20
 	/* input methods */
-	if((xw.xim =3D XOpenIM(xw.dpy, NULL, NULL, NULL)) =3D=3D NULL) {
+	if (!(xw.xim =3D XOpenIM(xw.dpy, NULL, NULL, NULL))) {
 		XSetLocaleModifiers("_AT_im=3Dlocal");
-		if((xw.xim =3D  XOpenIM(xw.dpy, NULL, NULL, NULL)) =3D=3D NULL) {
+		if (!(xw.xim =3D  XOpenIM(xw.dpy, NULL, NULL, NULL))) {
 			XSetLocaleModifiers("_AT_im=3D");
-			if((xw.xim =3D XOpenIM(xw.dpy,
-					NULL, NULL, NULL)) =3D=3D NULL) {
-				die("XOpenIM failed. Could not open input"
-					" device.\n");
+			if (!(xw.xim =3D XOpenIM(xw.dpy, NULL, NULL, NULL))) {
+				die("XOpenIM failed. Could not open input device.\n");
 			}
 		}
 	}
-	xw.xic =3D XCreateIC(xw.xim, XNInputStyle, XIMPreeditNothing
-					   | XIMStatusNothing, XNClientWindow, xw.win,
-					   XNFocusWindow, xw.win, NULL);
-	if(xw.xic =3D=3D NULL)
+	xw.xic =3D XCreateIC(xw.xim, XNInputStyle, XIMPreeditNothing | XIMStatusN=
othing,
+	                   XNClientWindow, xw.win, XNFocusWindow, xw.win, NULL);
+	if (!xw.xic)
 		die("XCreateIC failed. Could not obtain input method.\n");
=20
 	/* white cursor, black outline */
 	cursor =3D XCreateFontCursor(xw.dpy, XC_xterm);
 	XDefineCursor(xw.dpy, xw.win, cursor);
 	XRecolorCursor(xw.dpy, cursor,
-		&(XColor){.red =3D 0xffff, .green =3D 0xffff, .blue =3D 0xffff},
-		&(XColor){.red =3D 0x0000, .green =3D 0x0000, .blue =3D 0x0000});
+		&(XColor){ .red =3D 0xffff, .green =3D 0xffff, .blue =3D 0xffff },
+		&(XColor){ .red =3D 0x0000, .green =3D 0x0000, .blue =3D 0x0000 });
=20
-	xw.xembed =3D XInternAtom(xw.dpy, "_XEMBED", False);
-	xw.wmdeletewin =3D XInternAtom(xw.dpy, "WM_DELETE_WINDOW", False);
-	xw.netwmname =3D XInternAtom(xw.dpy, "_NET_WM_NAME", False);
+	xw.xembed      =3D XInternAtom(xw.dpy, "_XEMBED", 0);
+	xw.wmdeletewin =3D XInternAtom(xw.dpy, "WM_DELETE_WINDOW", 0);
+	xw.netwmname   =3D XInternAtom(xw.dpy, "_NET_WM_NAME", 0);
 	XSetWMProtocols(xw.dpy, xw.win, &xw.wmdeletewin, 1);
=20
-	xw.netwmpid =3D XInternAtom(xw.dpy, "_NET_WM_PID", False);
+	xw.netwmpid =3D XInternAtom(xw.dpy, "_NET_WM_PID", 0);
 	XChangeProperty(xw.dpy, xw.win, xw.netwmpid, XA_CARDINAL, 32,
-			PropModeReplace, (uchar *)&thispid, 1);
+	                PropModeReplace, (uchar *)&thispid, 1);
=20
 	xresettitle();
 	XMapWindow(xw.dpy, xw.win);
 	xhints();
-	XSync(xw.dpy, False);
+	XSync(xw.dpy, 0);
 }
=20
 int
 xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Glyph *glyphs, int len,=
 int x, int y)
 {
-	float winx =3D borderpx + x * xw.cw, winy =3D borderpx + y * xw.ch, xp, y=
p;
-	ushort mode, prevmode =3D USHRT_MAX;
 	Font *font =3D &dc.font;
-	int frcflags =3D FRC_NORMAL;
-	float runewidth =3D xw.cw;
 	Rune rune;
 	FT_UInt glyphidx;
-	FcResult fcres;
-	FcPattern *fcpattern, *fontpattern;
-	FcFontSet *fcsets[] =3D { NULL };
 	FcCharSet *fccharset;
+	FcFontSet *fcsets[] =3D { NULL };
+	FcPattern *fcpattern, *fontpattern;
+	FcResult fcres;
+	ushort mode, prevmode =3D USHRT_MAX;
+	int frcflags =3D FRC_NORMAL;
 	int i, f, numspecs =3D 0;
+	float winx =3D borderpx + x * xw.cw, winy =3D borderpx + y * xw.ch, xp, y=
p;
+	float runewidth =3D xw.cw;
=20
-	for(i =3D 0, xp =3D winx, yp =3D winy + font->ascent; i < len; ++i) {
+	for (i =3D 0, xp =3D winx, yp =3D winy + font->ascent; i < len; ++i) {
 		/* Fetch rune and mode for current glyph. */
 		rune =3D glyphs[i].u;
 		mode =3D glyphs[i].mode;
=20
 		/* Skip dummy wide-character spacing. */
-		if(mode =3D=3D ATTR_WDUMMY)
+		if (mode =3D=3D ATTR_WDUMMY)
 			continue;
=20
 		/* Determine font for glyph if different from previous glyph. */
-		if(prevmode !=3D mode) {
+		if (prevmode !=3D mode) {
 			prevmode =3D mode;
 			font =3D &dc.font;
 			frcflags =3D FRC_NORMAL;
 			runewidth =3D xw.cw * ((mode & ATTR_WIDE) ? 2.0f : 1.0f);
-			if((mode & ATTR_ITALIC) && (mode & ATTR_BOLD)) {
+			if ((mode & ATTR_ITALIC) && (mode & ATTR_BOLD)) {
 				font =3D &dc.ibfont;
 				frcflags =3D FRC_ITALICBOLD;
-			} else if(mode & ATTR_ITALIC) {
+			} else if (mode & ATTR_ITALIC) {
 				font =3D &dc.ifont;
 				frcflags =3D FRC_ITALIC;
-			} else if(mode & ATTR_BOLD) {
+			} else if (mode & ATTR_BOLD) {
 				font =3D &dc.bfont;
 				frcflags =3D FRC_BOLD;
 			}
_AT_@ -3320,7 +3313,7 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const Gl=
yph *glyphs, int len, int x
=20
 		/* Lookup character index with default font. */
 		glyphidx =3D XftCharIndex(xw.dpy, font->match, rune);
-		if(glyphidx) {
+		if (glyphidx) {
 			specs[numspecs].font =3D font->match;
 			specs[numspecs].glyph =3D glyphidx;
 			specs[numspecs].x =3D (short)xp;
_AT_@ -3331,23 +3324,23 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const =
Glyph *glyphs, int len, int x
 		}
=20
 		/* Fallback on font cache, search the font cache for match. */
-		for(f =3D 0; f < frclen; f++) {
+		for (f =3D 0; f < frclen; f++) {
 			glyphidx =3D XftCharIndex(xw.dpy, frc[f].font, rune);
 			/* Everything correct. */
-			if(glyphidx && frc[f].flags =3D=3D frcflags)
+			if (glyphidx && frc[f].flags =3D=3D frcflags)
 				break;
 			/* We got a default font for a not found glyph. */
-			if(!glyphidx && frc[f].flags =3D=3D frcflags
-					&& frc[f].unicodep =3D=3D rune) {
+			if (!glyphidx && (frc[f].flags =3D=3D frcflags) &&
+			    (frc[f].unicodep =3D=3D rune)) {
 				break;
 			}
 		}
=20
 		/* Nothing was found. Use fontconfig to find matching font. */
-		if(f >=3D frclen) {
-			if(!font->set)
+		if (f >=3D frclen) {
+			if (!font->set)
 				font->set =3D FcFontSort(0, font->pattern,
-				                       FcTrue, 0, &fcres);
+				                       1, 0, &fcres);
 			fcsets[0] =3D font->set;
=20
 			/*
_AT_@ -3361,30 +3354,25 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const =
Glyph *glyphs, int len, int x
 			fccharset =3D FcCharSetCreate();
=20
 			FcCharSetAddChar(fccharset, rune);
-			FcPatternAddCharSet(fcpattern, FC_CHARSET,
-					fccharset);
-			FcPatternAddBool(fcpattern, FC_SCALABLE,
-					FcTrue);
+			FcPatternAddCharSet(fcpattern, FC_CHARSET, fccharset);
+			FcPatternAddBool(fcpattern, FC_SCALABLE, 1);
=20
-			FcConfigSubstitute(0, fcpattern,
-					FcMatchPattern);
+			FcConfigSubstitute(0, fcpattern, FcMatchPattern);
 			FcDefaultSubstitute(fcpattern);
=20
-			fontpattern =3D FcFontSetMatch(0, fcsets, 1,
-					fcpattern, &fcres);
+			fontpattern =3D FcFontSetMatch(0, fcsets, 1, fcpattern, &fcres);
=20
 			/*
 			 * Overwrite or create the new cache entry.
 			 */
-			if(frclen >=3D LEN(frc)) {
+			if (frclen >=3D LEN(frc)) {
 				frclen =3D LEN(frc) - 1;
 				XftFontClose(xw.dpy, frc[frclen].font);
 				frc[frclen].unicodep =3D 0;
 			}
=20
-			frc[frclen].font =3D XftFontOpenPattern(xw.dpy,
-					fontpattern);
-			frc[frclen].flags =3D frcflags;
+			frc[frclen].font     =3D XftFontOpenPattern(xw.dpy, fontpattern);
+			frc[frclen].flags    =3D frcflags;
 			frc[frclen].unicodep =3D rune;
=20
 			glyphidx =3D XftCharIndex(xw.dpy, frc[frclen].font, rune);
_AT_@ -3396,10 +3384,10 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const =
Glyph *glyphs, int len, int x
 			FcCharSetDestroy(fccharset);
 		}
=20
-		specs[numspecs].font =3D frc[f].font;
+		specs[numspecs].font  =3D frc[f].font;
 		specs[numspecs].glyph =3D glyphidx;
-		specs[numspecs].x =3D (short)xp;
-		specs[numspecs].y =3D (short)(winy + frc[f].font->ascent);
+		specs[numspecs].x     =3D (short)xp;
+		specs[numspecs].y     =3D (short)(winy + frc[f].font->ascent);
 		xp +=3D runewidth;
 		numspecs++;
 	}
_AT_@ -3409,39 +3397,39 @@ xmakeglyphfontspecs(XftGlyphFontSpec *specs, const =
Glyph *glyphs, int len, int x
=20
 void
 xdrawglyphfontspecs(const XftGlyphFontSpec *specs, Glyph base, int len, in=
t x, int y) {
+	Color *fg, *bg, *temp, revfg, revbg, truefg, truebg;
+	XRectangle r;
+	XRenderColor colfg, colbg;
 	int charlen =3D len * ((base.mode & ATTR_WIDE) ? 2 : 1);
 	int winx =3D borderpx + x * xw.cw, winy =3D borderpx + y * xw.ch,
 	    width =3D charlen * xw.cw;
-	Color *fg, *bg, *temp, revfg, revbg, truefg, truebg;
-	XRenderColor colfg, colbg;
-	XRectangle r;
=20
 	/* Determine foreground and background colors based on mode. */
-	if(base.fg =3D=3D defaultfg) {
-		if(base.mode & ATTR_ITALIC)
+	if (base.fg =3D=3D defaultfg) {
+		if (base.mode & ATTR_ITALIC)
 			base.fg =3D defaultitalic;
-		else if((base.mode & ATTR_ITALIC) && (base.mode & ATTR_BOLD))
+		else if ((base.mode & ATTR_ITALIC) && (base.mode & ATTR_BOLD))
 			base.fg =3D defaultitalic;
-		else if(base.mode & ATTR_UNDERLINE)
+		else if (base.mode & ATTR_UNDERLINE)
 			base.fg =3D defaultunderline;
 	}
=20
-	if(IS_TRUECOL(base.fg)) {
-		colfg.alpha =3D 0xffff;
-		colfg.red =3D TRUERED(base.fg);
+	if (IS_TRUECOL(base.fg)) {
+		colfg.red   =3D TRUERED(base.fg);
 		colfg.green =3D TRUEGREEN(base.fg);
-		colfg.blue =3D TRUEBLUE(base.fg);
+		colfg.blue  =3D TRUEBLUE(base.fg);
+		colfg.alpha =3D 0xffff;
 		XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &colfg, &truefg);
 		fg =3D &truefg;
 	} else {
 		fg =3D &dc.col[base.fg];
 	}
=20
-	if(IS_TRUECOL(base.bg)) {
-		colbg.alpha =3D 0xffff;
+	if (IS_TRUECOL(base.bg)) {
+		colbg.red   =3D TRUERED(base.bg);
 		colbg.green =3D TRUEGREEN(base.bg);
-		colbg.red =3D TRUERED(base.bg);
-		colbg.blue =3D TRUEBLUE(base.bg);
+		colbg.blue  =3D TRUEBLUE(base.bg);
+		colbg.alpha =3D 0xffff;
 		XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &colbg, &truebg);
 		bg =3D &truebg;
 	} else {
_AT_@ -3449,91 +3437,87 @@ xdrawglyphfontspecs(const XftGlyphFontSpec *specs, =
Glyph base, int len, int x, i
 	}
=20
 	/* Change basic system colors [0-7] to bright system colors [8-15] */
-	if((base.mode & ATTR_BOLD_FAINT) =3D=3D ATTR_BOLD && BETWEEN(base.fg, 0, =
7))
+	if ((base.mode & ATTR_BOLD_FAINT) =3D=3D ATTR_BOLD && BETWEEN(base.fg, 0,=
 7))
 		fg =3D &dc.col[base.fg + 8];
=20
-	if(IS_SET(MODE_REVERSE)) {
-		if(fg =3D=3D &dc.col[defaultfg]) {
+	if (IS_SET(MODE_REVERSE)) {
+		if (fg =3D=3D &dc.col[defaultfg]) {
 			fg =3D &dc.col[defaultbg];
 		} else {
-			colfg.red =3D ~fg->color.red;
+			colfg.red   =3D ~fg->color.red;
 			colfg.green =3D ~fg->color.green;
-			colfg.blue =3D ~fg->color.blue;
-			colfg.alpha =3D fg->color.alpha;
-			XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &colfg,
-					&revfg);
+			colfg.blue  =3D ~fg->color.blue;
+			colfg.alpha =3D  fg->color.alpha;
+			XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &colfg, &revfg);
 			fg =3D &revfg;
 		}
=20
-		if(bg =3D=3D &dc.col[defaultbg]) {
+		if (bg =3D=3D &dc.col[defaultbg]) {
 			bg =3D &dc.col[defaultfg];
 		} else {
-			colbg.red =3D ~bg->color.red;
+			colbg.red   =3D ~bg->color.red;
 			colbg.green =3D ~bg->color.green;
-			colbg.blue =3D ~bg->color.blue;
-			colbg.alpha =3D bg->color.alpha;
-			XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &colbg,
-					&revbg);
+			colbg.blue  =3D ~bg->color.blue;
+			colbg.alpha =3D  bg->color.alpha;
+			XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &colbg, &revbg);
 			bg =3D &revbg;
 		}
 	}
=20
-	if(base.mode & ATTR_REVERSE) {
+	if (base.mode & ATTR_REVERSE) {
 		temp =3D fg;
 		fg =3D bg;
 		bg =3D temp;
 	}
=20
-	if((base.mode & ATTR_BOLD_FAINT) =3D=3D ATTR_FAINT) {
-		colfg.red =3D fg->color.red / 2;
+	if ((base.mode & ATTR_BOLD_FAINT) =3D=3D ATTR_FAINT) {
+		colfg.red   =3D fg->color.red   / 2;
 		colfg.green =3D fg->color.green / 2;
-		colfg.blue =3D fg->color.blue / 2;
+		colfg.blue  =3D fg->color.blue  / 2;
 		XftColorAllocValue(xw.dpy, xw.vis, xw.cmap, &colfg, &revfg);
 		fg =3D &revfg;
 	}
=20
-	if(base.mode & ATTR_BLINK && term.mode & MODE_BLINK)
+	if (base.mode & ATTR_BLINK && term.mode & MODE_BLINK)
 		fg =3D bg;
=20
-	if(base.mode & ATTR_INVISIBLE)
+	if (base.mode & ATTR_INVISIBLE)
 		fg =3D bg;
=20
 	/* Intelligent cleaning up of the borders. */
-	if(x =3D=3D 0) {
+	if (x =3D=3D 0) {
 		xclear(0, (y =3D=3D 0)? 0 : winy, borderpx,
-			winy + xw.ch + ((y >=3D term.row-1)? xw.h : 0));
+		       winy + xw.ch + ((y >=3D term.row - 1) ? xw.h : 0));
 	}
-	if(x + charlen >=3D term.col) {
-		xclear(winx + width, (y =3D=3D 0)? 0 : winy, xw.w,
-			((y >=3D term.row-1)? xw.h : (winy + xw.ch)));
+	if (x + charlen >=3D term.col) {
+		xclear(winx + width, (y =3D=3D 0) ? 0 : winy, xw.w,
+		       ((y >=3D term.row - 1) ? xw.h : (winy + xw.ch)));
 	}
-	if(y =3D=3D 0)
+	if (y =3D=3D 0)
 		xclear(winx, 0, winx + width, borderpx);
-	if(y =3D=3D term.row-1)
+	if (y =3D=3D term.row - 1)
 		xclear(winx, winy + xw.ch, winx + width, xw.h);
=20
 	/* Clean up the region we want to draw to. */
 	XftDrawRect(xw.draw, bg, winx, winy, width, xw.ch);
=20
 	/* Set the clip region because Xft is sometimes dirty. */
-	r.x =3D 0;
-	r.y =3D 0;
+	r.x      =3D 0;
+	r.y      =3D 0;
 	r.height =3D xw.ch;
-	r.width =3D width;
+	r.width  =3D width;
 	XftDrawSetClipRectangles(xw.draw, winx, winy, &r, 1);
=20
 	/* Render the glyphs. */
 	XftDrawGlyphFontSpec(xw.draw, fg, specs, len);
=20
 	/* Render underline and strikethrough. */
-	if(base.mode & ATTR_UNDERLINE) {
-		XftDrawRect(xw.draw, fg, winx, winy + dc.font.ascent + 1,
-				width, 1);
+	if (base.mode & ATTR_UNDERLINE) {
+		XftDrawRect(xw.draw, fg, winx, winy + dc.font.ascent + 1, width, 1);
 	}
=20
-	if(base.mode & ATTR_STRUCK) {
-		XftDrawRect(xw.draw, fg, winx, winy + 2 * dc.font.ascent / 3,
-				width, 1);
+	if (base.mode & ATTR_STRUCK) {
+		XftDrawRect(xw.draw, fg, winx, winy + 2 * dc.font.ascent / 3, width, 1);
 	}
=20
 	/* Reset clip to none. */
_AT_@ -3544,25 +3528,26 @@ void
 xdrawglyph(Glyph g, int x, int y) {
 	int numspecs;
 	XftGlyphFontSpec spec;
+
 	numspecs =3D xmakeglyphfontspecs(&spec, &g, 1, x, y);
 	xdrawglyphfontspecs(&spec, g, numspecs, x, y);
 }
=20
 void
 xdrawcursor(void) {
+	Glyph g =3D { ' ', ATTR_NULL, defaultbg, defaultcs };
 	static int oldx =3D 0, oldy =3D 0;
 	int curx;
-	Glyph g =3D {' ', ATTR_NULL, defaultbg, defaultcs};
=20
-	LIMIT(oldx, 0, term.col-1);
-	LIMIT(oldy, 0, term.row-1);
+	LIMIT(oldx, 0, term.col - 1);
+	LIMIT(oldy, 0, term.row - 1);
=20
 	curx =3D term.c.x;
=20
 	/* adjust position if in dummy */
-	if(term.line[oldy][oldx].mode & ATTR_WDUMMY)
+	if (term.line[oldy][oldx].mode & ATTR_WDUMMY)
 		oldx--;
-	if(term.line[term.c.y][curx].mode & ATTR_WDUMMY)
+	if (term.line[term.c.y][curx].mode & ATTR_WDUMMY)
 		curx--;
=20
 	g.u =3D term.line[term.c.y][term.c.x].u;
_AT_@ -3570,19 +3555,19 @@ xdrawcursor(void) {
 	/* remove the old cursor */
 	xdrawglyph(term.line[oldy][oldx], oldx, oldy);
=20
-	if(IS_SET(MODE_HIDE))
+	if (IS_SET(MODE_HIDE))
 		return;
=20
 	/* draw the new one */
-	if(xw.state & WIN_FOCUSED) {
+	if (xw.state & WIN_FOCUSED) {
 		switch (xw.cursor) {
 			case 0: /* Blinking Block */
 			case 1: /* Blinking Block (Default) */
 			case 2: /* Steady Block */
-				if(IS_SET(MODE_REVERSE)) {
+				if (IS_SET(MODE_REVERSE)) {
 						g.mode |=3D ATTR_REVERSE;
-						g.fg =3D defaultcs;
-						g.bg =3D defaultfg;
+						g.fg    =3D defaultcs;
+						g.bg    =3D defaultfg;
 					}
=20
 				g.mode |=3D term.line[term.c.y][curx].mode & ATTR_WIDE;
_AT_@ -3591,35 +3576,36 @@ xdrawcursor(void) {
 			case 3: /* Blinking Underline */
 			case 4: /* Steady Underline */
 				XftDrawRect(xw.draw, &dc.col[defaultcs],
-						borderpx + curx * xw.cw,
-						borderpx + (term.c.y + 1) * xw.ch - cursorthickness,
-						xw.cw, cursorthickness);
+				            borderpx + curx * xw.cw,
+				            borderpx + (term.c.y + 1) * xw.ch
+					    - cursorthickness,
+				            xw.cw, cursorthickness);
 				break;
 			case 5: /* Blinking bar */
 			case 6: /* Steady bar */
 				XftDrawRect(xw.draw, &dc.col[defaultcs],
-						borderpx + curx * xw.cw,
-						borderpx + term.c.y * xw.ch,
-						cursorthickness, xw.ch);
+				            borderpx + curx * xw.cw,
+				            borderpx + term.c.y * xw.ch,
+				            cursorthickness, xw.ch);
 				break;
 		}
 	} else {
 		XftDrawRect(xw.draw, &dc.col[defaultcs],
-				borderpx + curx * xw.cw,
-				borderpx + term.c.y * xw.ch,
-				xw.cw - 1, 1);
+		            borderpx + curx * xw.cw,
+		            borderpx + term.c.y * xw.ch,
+		            xw.cw - 1, 1);
 		XftDrawRect(xw.draw, &dc.col[defaultcs],
-				borderpx + curx * xw.cw,
-				borderpx + term.c.y * xw.ch,
-				1, xw.ch - 1);
+		            borderpx + curx * xw.cw,
+		            borderpx + term.c.y * xw.ch,
+		            1, xw.ch - 1);
 		XftDrawRect(xw.draw, &dc.col[defaultcs],
-				borderpx + (curx + 1) * xw.cw - 1,
-				borderpx + term.c.y * xw.ch,
-				1, xw.ch - 1);
+		            borderpx + (curx + 1) * xw.cw - 1,
+		            borderpx + term.c.y * xw.ch,
+		            1, xw.ch - 1);
 		XftDrawRect(xw.draw, &dc.col[defaultcs],
-				borderpx + curx * xw.cw,
-				borderpx + (term.c.y + 1) * xw.ch - 1,
-				xw.cw, 1);
+		            borderpx + curx * xw.cw,
+		            borderpx + (term.c.y + 1) * xw.ch - 1,
+		            xw.cw, 1);
 	}
 	oldx =3D curx, oldy =3D term.c.y;
 }
_AT_@ -3629,8 +3615,7 @@ void
 xsettitle(char *p) {
 	XTextProperty prop;
=20
-	Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle,
-			&prop);
+	Xutf8TextListToTextProperty(xw.dpy, &p, 1, XUTF8StringStyle, &prop);
 	XSetWMName(xw.dpy, xw.win, &prop);
 	XSetTextProperty(xw.dpy, xw.win, &prop, xw.netwmname);
 	XFree(prop.value);
_AT_@ -3650,25 +3635,23 @@ redraw(void) {
 void
 draw(void) {
 	drawregion(0, 0, term.col, term.row);
-	XCopyArea(xw.dpy, xw.buf, xw.win, dc.gc, 0, 0, xw.w,
-			xw.h, 0, 0);
+	XCopyArea(xw.dpy, xw.buf, xw.win, dc.gc, 0, 0, xw.w, xw.h, 0, 0);
 	XSetForeground(xw.dpy, dc.gc,
-			dc.col[IS_SET(MODE_REVERSE)?
-				defaultfg : defaultbg].pixel);
+	               dc.col[IS_SET(MODE_REVERSE) ? defaultfg : defaultbg].pixel=
);
 }
=20
 void
 drawregion(int x1, int y1, int x2, int y2) {
-	int i, x, y, ox, numspecs;
 	Glyph base, new;
 	XftGlyphFontSpec* specs;
+	int i, x, y, ox, numspecs;
 	int ena_sel =3D (sel.ob.x !=3D -1) && (sel.alt =3D=3D IS_SET(MODE_ALTSCRE=
EN));
=20
-	if(!(xw.state & WIN_VISIBLE))
+	if (!(xw.state & WIN_VISIBLE))
 		return;
=20
-	for(y =3D y1; y < y2; y++) {
-		if(!term.dirty[y])
+	for (y =3D y1; y < y2; y++) {
+		if (!term.dirty[y])
 			continue;
=20
 		xtermclear(0, y, term.col, y);
_AT_@ -3678,25 +3661,25 @@ drawregion(int x1, int y1, int x2, int y2) {
 		numspecs =3D xmakeglyphfontspecs(specs, &term.line[y][x1], x2 - x1, x1, =
y);
=20
 		i =3D ox =3D 0;
-		for(x =3D x1; x < x2 && i < numspecs; x++) {
+		for (x =3D x1; x < x2 && i < numspecs; x++) {
 			new =3D term.line[y][x];
-			if(new.mode =3D=3D ATTR_WDUMMY)
+			if (new.mode =3D=3D ATTR_WDUMMY)
 				continue;
-			if(ena_sel && selected(x, y))
+			if (ena_sel && selected(x, y))
 				new.mode ^=3D ATTR_REVERSE;
-			if(i > 0 && ATTRCMP(base, new)) {
+			if (i > 0 && ATTRCMP(base, new)) {
 				xdrawglyphfontspecs(specs, base, i, ox, y);
 				specs +=3D i;
 				numspecs -=3D i;
 				i =3D 0;
 			}
-			if(i =3D=3D 0) {
+			if (i =3D=3D 0) {
 				ox =3D x;
 				base =3D new;
 			}
 			i++;
 		}
-		if(i > 0)
+		if (i > 0)
 			xdrawglyphfontspecs(specs, base, i, ox, y);
 	}
 	xdrawcursor();
_AT_@ -3738,19 +3721,19 @@ void
 focus(XEvent *ev) {
 	XFocusChangeEvent *e =3D &ev->xfocus;
=20
-	if(e->mode =3D=3D NotifyGrab)
+	if (e->mode =3D=3D NotifyGrab)
 		return;
=20
-	if(ev->type =3D=3D FocusIn) {
+	if (ev->type =3D=3D FocusIn) {
 		XSetICFocus(xw.xic);
 		xw.state |=3D WIN_FOCUSED;
 		xseturgency(0);
-		if(IS_SET(MODE_FOCUS))
+		if (IS_SET(MODE_FOCUS))
 			ttywrite("\033[I", 3);
 	} else {
 		XUnsetICFocus(xw.xic);
 		xw.state &=3D ~WIN_FOCUSED;
-		if(IS_SET(MODE_FOCUS))
+		if (IS_SET(MODE_FOCUS))
 			ttywrite("\033[O", 3);
 	}
 }
_AT_@ -3771,31 +3754,31 @@ kmap(KeySym k, uint state) {
 	int i;
=20
 	/* Check for mapped keys out of X11 function keys. */
-	for(i =3D 0; i < LEN(mappedkeys); i++) {
-		if(mappedkeys[i] =3D=3D k)
+	for (i =3D 0; i < LEN(mappedkeys); i++) {
+		if (mappedkeys[i] =3D=3D k)
 			break;
 	}
-	if(i =3D=3D LEN(mappedkeys)) {
-		if((k & 0xFFFF) < 0xFD00)
+	if (i =3D=3D LEN(mappedkeys)) {
+		if ((k & 0xFFFF) < 0xFD00)
 			return NULL;
 	}
=20
-	for(kp =3D key; kp < key + LEN(key); kp++) {
-		if(kp->k !=3D k)
+	for (kp =3D key; kp < key + LEN(key); kp++) {
+		if (kp->k !=3D k)
 			continue;
=20
-		if(!match(kp->mask, state))
+		if (!match(kp->mask, state))
 			continue;
=20
-		if(IS_SET(MODE_APPKEYPAD) ? kp->appkey < 0 : kp->appkey > 0)
+		if (IS_SET(MODE_APPKEYPAD) ? kp->appkey < 0 : kp->appkey > 0)
 			continue;
-		if(term.numlock && kp->appkey =3D=3D 2)
+		if (term.numlock && kp->appkey =3D=3D 2)
 			continue;
=20
-		if(IS_SET(MODE_APPCURSOR) ? kp->appcursor < 0 : kp->appcursor > 0)
+		if (IS_SET(MODE_APPCURSOR) ? kp->appcursor < 0 : kp->appcursor > 0)
 			continue;
=20
-		if(IS_SET(MODE_CRLF) ? kp->crlf < 0 : kp->crlf > 0)
+		if (IS_SET(MODE_CRLF) ? kp->crlf < 0 : kp->crlf > 0)
 			continue;
=20
 		return kp->s;
_AT_@ -3806,38 +3789,38 @@ kmap(KeySym k, uint state) {
=20
 void
 kpress(XEvent *ev) {
-	XKeyEvent *e =3D &ev->xkey;
 	KeySym ksym;
-	char buf[32], *customkey;
-	int len;
 	Rune c;
-	Status status;
 	Shortcut *bp;
+	Status status;
+	XKeyEvent *e =3D &ev->xkey;
+	int len;
+	char buf[32], *customkey;
=20
-	if(IS_SET(MODE_KBDLOCK))
+	if (IS_SET(MODE_KBDLOCK))
 		return;
=20
 	len =3D XmbLookupString(xw.xic, e, buf, sizeof buf, &ksym, &status);
 	/* 1. shortcuts */
-	for(bp =3D shortcuts; bp < shortcuts + LEN(shortcuts); bp++) {
-		if(ksym =3D=3D bp->keysym && match(bp->mod, e->state)) {
+	for (bp =3D shortcuts; bp < shortcuts + LEN(shortcuts); bp++) {
+		if (ksym =3D=3D bp->keysym && match(bp->mod, e->state)) {
 			bp->func(&(bp->arg));
 			return;
 		}
 	}
=20
 	/* 2. custom keys from config.h */
-	if((customkey =3D kmap(ksym, e->state))) {
+	if ((customkey =3D kmap(ksym, e->state))) {
 		ttysend(customkey, strlen(customkey));
 		return;
 	}
=20
 	/* 3. composed string from input method */
-	if(len =3D=3D 0)
+	if (len =3D=3D 0)
 		return;
-	if(len =3D=3D 1 && e->state & Mod1Mask) {
-		if(IS_SET(MODE_8BIT)) {
-			if(*buf < 0177) {
+	if (len =3D=3D 1 && e->state & Mod1Mask) {
+		if (IS_SET(MODE_8BIT)) {
+			if (*buf < 0177) {
 				c =3D *buf | 0x80;
 				len =3D utf8encode(c, buf);
 			}
_AT_@ -3857,14 +3840,14 @@ cmessage(XEvent *e) {
 	 * See xembed specs
 	 *  http://standards.freedesktop.org/xembed-spec/xembed-spec-latest.html
 	 */
-	if(e->xclient.message_type =3D=3D xw.xembed && e->xclient.format =3D=3D 3=
2) {
-		if(e->xclient.data.l[1] =3D=3D XEMBED_FOCUS_IN) {
+	if (e->xclient.message_type =3D=3D xw.xembed && e->xclient.format =3D=3D =
32) {
+		if (e->xclient.data.l[1] =3D=3D XEMBED_FOCUS_IN) {
 			xw.state |=3D WIN_FOCUSED;
 			xseturgency(0);
-		} else if(e->xclient.data.l[1] =3D=3D XEMBED_FOCUS_OUT) {
+		} else if (e->xclient.data.l[1] =3D=3D XEMBED_FOCUS_OUT) {
 			xw.state &=3D ~WIN_FOCUSED;
 		}
-	} else if(e->xclient.data.l[0] =3D=3D xw.wmdeletewin) {
+	} else if (e->xclient.data.l[0] =3D=3D xw.wmdeletewin) {
 		/* Send SIGHUP to shell */
 		kill(pid, SIGHUP);
 		exit(0);
_AT_@ -3875,9 +3858,9 @@ void
 cresize(int width, int height) {
 	int col, row;
=20
-	if(width !=3D 0)
+	if (width)
 		xw.w =3D width;
-	if(height !=3D 0)
+	if (height)
 		xw.h =3D height;
=20
 	col =3D (xw.w - 2 * borderpx) / xw.cw;
_AT_@ -3890,7 +3873,7 @@ cresize(int width, int height) {
=20
 void
 resize(XEvent *e) {
-	if(e->xconfigure.width =3D=3D xw.w && e->xconfigure.height =3D=3D xw.h)
+	if (e->xconfigure.width =3D=3D xw.w && e->xconfigure.height =3D=3D xw.h)
 		return;
=20
 	cresize(e->xconfigure.width, e->xconfigure.height);
_AT_@ -3899,11 +3882,11 @@ resize(XEvent *e) {
 void
 run(void) {
 	XEvent ev;
-	int w =3D xw.w, h =3D xw.h;
 	fd_set rfd;
-	int xfd =3D XConnectionNumber(xw.dpy), xev, blinkset =3D 0, dodraw =3D 0;
 	struct timespec drawtimeout, *tv =3D NULL, now, last, lastblink;
 	long deltatime;
+	int w =3D xw.w, h =3D xw.h;
+	int xfd =3D XConnectionNumber(xw.dpy), xev, blinkset =3D 0, dodraw =3D 0;
=20
 	/* Waiting for window mapping */
 	do {
_AT_@ -3913,13 +3896,13 @@ run(void) {
 		 * this is not unnecessary.It does not only filter the key event,
 		 * but some clientmessage for input method as well.
 		 */
-		if(XFilterEvent(&ev, None))
+		if (XFilterEvent(&ev, None))
 			continue;
-		if(ev.type =3D=3D ConfigureNotify) {
+		if (ev.type =3D=3D ConfigureNotify) {
 			w =3D ev.xconfigure.width;
 			h =3D ev.xconfigure.height;
 		}
-	} while(ev.type !=3D MapNotify);
+	} while (ev.type !=3D MapNotify);
=20
 	ttynew();
 	cresize(w, h);
_AT_@ -3927,70 +3910,68 @@ run(void) {
 	clock_gettime(CLOCK_MONOTONIC, &last);
 	lastblink =3D last;
=20
-	for(xev =3D actionfps;;) {
+	for (xev =3D actionfps;;) {
 		FD_ZERO(&rfd);
 		FD_SET(cmdfd, &rfd);
 		FD_SET(xfd, &rfd);
=20
-		if(pselect(MAX(xfd, cmdfd)+1, &rfd, NULL, NULL, tv, NULL) < 0) {
-			if(errno =3D=3D EINTR)
+		if (pselect(MAX(xfd, cmdfd) + 1, &rfd, NULL, NULL, tv, NULL) < 0) {
+			if (errno =3D=3D EINTR)
 				continue;
 			die("select failed: %s\n", strerror(errno));
 		}
-		if(FD_ISSET(cmdfd, &rfd)) {
+		if (FD_ISSET(cmdfd, &rfd)) {
 			ttyread();
-			if(blinktimeout) {
+			if (blinktimeout) {
 				blinkset =3D tattrset(ATTR_BLINK);
-				if(!blinkset)
+				if (!blinkset)
 					MODBIT(term.mode, 0, MODE_BLINK);
 			}
 		}
=20
-		if(FD_ISSET(xfd, &rfd))
+		if (FD_ISSET(xfd, &rfd))
 			xev =3D actionfps;
=20
 		clock_gettime(CLOCK_MONOTONIC, &now);
 		drawtimeout.tv_sec =3D 0;
-		drawtimeout.tv_nsec =3D  (1000 * 1E6)/ xfps;
+		drawtimeout.tv_nsec =3D  (1000 * 1E6) / xfps;
 		tv =3D &drawtimeout;
=20
 		dodraw =3D 0;
-		if(blinktimeout && TIMEDIFF(now, lastblink) > blinktimeout) {
+		if (blinktimeout && TIMEDIFF(now, lastblink) > blinktimeout) {
 			tsetdirtattr(ATTR_BLINK);
 			term.mode ^=3D MODE_BLINK;
 			lastblink =3D now;
 			dodraw =3D 1;
 		}
 		deltatime =3D TIMEDIFF(now, last);
-		if(deltatime > 1000 / (xev ? xfps : actionfps)) {
+		if (deltatime > 1000 / (xev ? xfps : actionfps)) {
 			dodraw =3D 1;
 			last =3D now;
 		}
=20
-		if(dodraw) {
-			while(XPending(xw.dpy)) {
+		if (dodraw) {
+			while (XPending(xw.dpy)) {
 				XNextEvent(xw.dpy, &ev);
-				if(XFilterEvent(&ev, None))
+				if (XFilterEvent(&ev, None))
 					continue;
-				if(handler[ev.type])
+				if (handler[ev.type])
 					(handler[ev.type])(&ev);
 			}
=20
 			draw();
 			XFlush(xw.dpy);
=20
-			if(xev && !FD_ISSET(xfd, &rfd))
+			if (xev && !FD_ISSET(xfd, &rfd))
 				xev--;
-			if(!FD_ISSET(cmdfd, &rfd) && !FD_ISSET(xfd, &rfd)) {
-				if(blinkset) {
-					if(TIMEDIFF(now, lastblink) \
-							> blinktimeout) {
+			if (!FD_ISSET(cmdfd, &rfd) && !FD_ISSET(xfd, &rfd)) {
+				if (blinkset) {
+					if (TIMEDIFF(now, lastblink) > blinktimeout) {
 						drawtimeout.tv_nsec =3D 1000;
 					} else {
 						drawtimeout.tv_nsec =3D (1E6 * \
 							(blinktimeout - \
-							TIMEDIFF(now,
-								lastblink)));
+							TIMEDIFF(now, lastblink)));
 					}
 					drawtimeout.tv_sec =3D \
 					    drawtimeout.tv_nsec / 1E9;
_AT_@ -4018,7 +3999,7 @@ main(int argc, char *argv[]) {
 	uint cols =3D 80, rows =3D 24;
=20
 	xw.l =3D xw.t =3D 0;
-	xw.isfixed =3D False;
+	xw.isfixed =3D 0;
 	xw.cursor =3D 0;
=20
 	ARGBEGIN {
_AT_@ -4029,18 +4010,17 @@ main(int argc, char *argv[]) {
 		opt_class =3D EARGF(usage());
 		break;
 	case 'e':
-		if(argc > 0)
+		if (argc > 0)
 			--argc, ++argv;
 		goto run;
 	case 'f':
 		opt_font =3D EARGF(usage());
 		break;
 	case 'g':
-		xw.gm =3D XParseGeometry(EARGF(usage()),
-				&xw.l, &xw.t, &cols, &rows);
+		xw.gm =3D XParseGeometry(EARGF(usage()), &xw.l, &xw.t, &cols, &rows);
 		break;
 	case 'i':
-		xw.isfixed =3D True;
+		xw.isfixed =3D 1;
 		break;
 	case 'o':
 		opt_io =3D EARGF(usage());
_AT_@ -4060,10 +4040,10 @@ main(int argc, char *argv[]) {
 	} ARGEND;
=20
 run:
-	if(argc > 0) {
+	if (argc) {
 		/* eat all remaining arguments */
 		opt_cmd =3D argv;
-		if(!opt_title && !opt_line)
+		if (!opt_title && !opt_line)
 			opt_title =3D basename(xstrdup(argv[0]));
 	}
 	setlocale(LC_CTYPE, "");
_AT_@ -4075,4 +4055,3 @@ run:
=20
 	return 0;
 }
-
--=20
1.8.5.5
--Multipart=_Wed__8_Jul_2015_20_45_23_+0200_.YLrupkOLV48Y1fT
Content-Type: text/x-diff;
 name="0005-Make-config.def.h-more-consistent.patch"
Content-Disposition: attachment;
 filename="0005-Make-config.def.h-more-consistent.patch"
Content-Transfer-Encoding: 7bit
Received on Mon Sep 17 2001 - 00:00:00 CEST

This archive was generated by hypermail 2.3.0 : Wed Jul 08 2015 - 22:36:09 CEST