about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--client.c4
-rw-r--r--draw.c4
-rw-r--r--event.c4
-rw-r--r--main.c14
-rw-r--r--tag.c4
5 files changed, 16 insertions, 14 deletions
diff --git a/client.c b/client.c
index 220d2a0..74cadb5 100644
--- a/client.c
+++ b/client.c
@@ -361,12 +361,12 @@ updatetitle(Client *c) {
 	if(!name.nitems)
 		return;
 	if(name.encoding == XA_STRING)
-		strncpy(c->name, (char *)name.value, sizeof(c->name));
+		strncpy(c->name, (char *)name.value, sizeof c->name);
 	else {
 		if(XmbTextPropertyToTextList(dpy, &name, &list, &n) >= Success
 				&& n > 0 && *list)
 		{
-			strncpy(c->name, *list, sizeof(c->name));
+			strncpy(c->name, *list, sizeof c->name);
 			XFreeStringList(list);
 		}
 	}
diff --git a/draw.c b/draw.c
index 4441a88..671062c 100644
--- a/draw.c
+++ b/draw.c
@@ -43,8 +43,8 @@ drawtext(const char *text, unsigned long col[ColLast], Bool ldot, Bool rdot) {
 		return;
 	w = 0;
 	olen = len = strlen(text);
-	if(len >= sizeof(buf))
-		len = sizeof(buf) - 1;
+	if(len >= sizeof buf)
+		len = sizeof buf - 1;
 	memcpy(buf, text, len);
 	buf[len] = 0;
 	h = dc.font.ascent + dc.font.descent;
diff --git a/event.c b/event.c
index 23dcf55..edfcc52 100644
--- a/event.c
+++ b/event.c
@@ -244,7 +244,7 @@ expose(XEvent *e) {
 
 static void
 keypress(XEvent *e) {
-	static unsigned int len = sizeof(key) / sizeof(key[0]);
+	static unsigned int len = sizeof key / sizeof key[0];
 	unsigned int i;
 	KeySym keysym;
 	XKeyEvent *ev = &e->xkey;
@@ -355,7 +355,7 @@ void (*handler[LASTEvent]) (XEvent *) = {
 
 void
 grabkeys(void) {
-	static unsigned int len = sizeof(key) / sizeof(key[0]);
+	static unsigned int len = sizeof key / sizeof key[0];
 	unsigned int i;
 	KeyCode code;
 
diff --git a/main.c b/main.c
index 86cd3f9..f196df7 100644
--- a/main.c
+++ b/main.c
@@ -227,6 +227,7 @@ xerror(Display *dpy, XErrorEvent *ee) {
 
 int
 main(int argc, char *argv[]) {
+	char *p;
 	int r, xfd;
 	fd_set rd;
 
@@ -270,22 +271,23 @@ main(int argc, char *argv[]) {
 		if(select(xfd + 1, &rd, NULL, NULL, NULL) == -1) {
 			if(errno == EINTR)
 				continue;
-			else
-				eprint("select failed\n");
+			eprint("select failed\n");
 		}
 		if(FD_ISSET(STDIN_FILENO, &rd)) {
-			switch(r = read(STDIN_FILENO, stext, sizeof(stext) - 1)) {
+			switch(r = read(STDIN_FILENO, stext, sizeof stext - 1)) {
 			case -1:
-				strncpy(stext, strerror(errno), sizeof(stext));
-				stext[sizeof(stext) - 1] = '\0';
+				strncpy(stext, strerror(errno), sizeof stext - 1);
 				readin = False;
 				break;
 			case 0:
-				strncpy(stext, "EOF", sizeof(stext));
+				strncpy(stext, "EOF", sizeof stext);
 				readin = False;
 				break;
 			default:
 				stext[r - (stext[r - 1] == '\n' ? 1 : 0)] = '\0';
+				for(p = stext + strlen(stext) - 1; p > stext && *p != '\n'; --p);
+				if(p > stext)
+					strncpy(stext, p + 1, sizeof stext);
 			}
 			drawstatus();
 		}
diff --git a/tag.c b/tag.c
index fd08853..b1a2eb9 100644
--- a/tag.c
+++ b/tag.c
@@ -50,7 +50,7 @@ initrregs(void) {
 
 	if(rreg)
 		return;
-	len = sizeof(rule) / sizeof(rule[0]);
+	len = sizeof rule / sizeof rule[0];
 	rreg = emallocz(len * sizeof(RReg));
 	for(i = 0; i < len; i++) {
 		if(rule[i].clpattern) {
@@ -83,7 +83,7 @@ settags(Client *c, Client *trans) {
 			c->tags[i] = trans->tags[i];
 	}
 	else if(XGetClassHint(dpy, c->win, &ch)) {
-		snprintf(prop, sizeof(prop), "%s:%s:%s",
+		snprintf(prop, sizeof prop, "%s:%s:%s",
 				ch.res_class ? ch.res_class : "",
 				ch.res_name ? ch.res_name : "", c->name);
 		for(i = 0; !matched && i < len; i++)
/blame/aerc.go?h=0.5.0&id=fe79a9a5879936a7f5b16cc6a8be1d93ec1bfae7'>^
2a09617 ^


































f42724c ^


74af57b ^
f42724c ^

d43684c ^



aeb7005
74af57b ^


d43684c ^

74af57b ^








d43684c ^
74af57b ^

648ca98 ^



a21afda ^




1767e4f ^
a21afda ^

d85f671 ^
a0be5e8 ^
b275a39 ^

39c93d2 ^
60b351b ^
f406bf5 ^



2a09617 ^
b60999c ^
2a09617 ^



b60999c ^
f406bf5 ^
77a0f68 ^


1418e1b ^
60b351b ^
de122b1 ^
a15ea01 ^


1418e1b ^
661e3ec ^

305446a ^
6394e38 ^
aeb7005
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161