commit 26bd6db557b3e60b3746c3924680a21f045a0f9b
parent 05053cb9954cdfab6c87d07f66ed34d19f9aa30a
Author: Kris Maglione <kris@suckless.org>
Date: Sat, 31 Jul 2010 16:20:51 -0400
[menu] Fix numeric keypad input. Closes issue #213.
Diffstat:
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/cmd/menu/history.c b/cmd/menu/history.c
@@ -82,7 +82,10 @@ history_dump(const char *path, int max) {
Binit(&b, fd, OWRITE);
hist.next = nil;
for(h=first; h; h=h->next)
- Bprint(&b, "%s\n", h->string);
+ if(Bprint(&b, "%s\n", h->string) < 0) {
+ unlink(tmp);
+ exit(1);
+ }
Bterm(&b);
rename(tmp, path);
exit(0);
diff --git a/cmd/menu/menu.c b/cmd/menu/menu.c
@@ -265,8 +265,9 @@ kdown_event(Window *w, void *aux, XKeyEvent *e) {
int num;
KeySym ksym;
- buf[0] = 0;
+ buf[0] = '\0';
num = XLookupString(e, buf, sizeof buf, &ksym, 0);
+ buf[num] = '\0';
key = XKeysymToString(ksym);
if(IsKeypadKey(ksym))
if(ksym == XK_KP_Enter)
diff --git a/cmd/wmii/message.c b/cmd/wmii/message.c
@@ -907,13 +907,12 @@ msg_nudge(View *v, IxpMsg *m) {
void
msg_parsecolors(IxpMsg *m, CTuple *col) {
CTuple tpl;
- static char Ebad[] = "bad color string";
char n;
n = loadcolor(&tpl, m->pos, m->end);
m->pos += n;
if(n == 0 || msg_getword(m, nil))
- error(Ebad);
+ error("bad color string");
*col = tpl;
}