aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor Lane Smith <cls@lubutu.com>2011-05-06 21:13:02 +0100
committerConnor Lane Smith <cls@lubutu.com>2011-05-06 21:13:02 +0100
commitcd3b4915c3358b93f8dbff531bff82c0cd833c0b (patch)
tree285f3515ff567d3b61da59229892909967f0c712
parent210b303941e517a9d7df1cba1e3229165fb4037b (diff)
helpful errors
-rw-r--r--dmenu.c4
-rw-r--r--draw.c7
2 files changed, 8 insertions, 3 deletions
diff --git a/dmenu.c b/dmenu.c
index d8ef88f..5be73f7 100644
--- a/dmenu.c
+++ b/dmenu.c
@@ -440,9 +440,9 @@ readstdin(void) {
440 if((p = strchr(buf, '\n'))) 440 if((p = strchr(buf, '\n')))
441 *p = '\0'; 441 *p = '\0';
442 if(!(item = calloc(1, sizeof *item))) 442 if(!(item = calloc(1, sizeof *item)))
443 eprintf("cannot malloc %u bytes\n", sizeof *item); 443 eprintf("cannot malloc %u bytes:", sizeof *item);
444 if(!(item->text = strdup(buf))) 444 if(!(item->text = strdup(buf)))
445 eprintf("cannot strdup %u bytes\n", strlen(buf)+1); 445 eprintf("cannot strdup %u bytes:", strlen(buf)+1);
446 inputw = MAX(inputw, textw(dc, item->text)); 446 inputw = MAX(inputw, textw(dc, item->text));
447 } 447 }
448} 448}
diff --git a/draw.c b/draw.c
index 80a5074..83ced4b 100644
--- a/draw.c
+++ b/draw.c
@@ -68,6 +68,11 @@ eprintf(const char *fmt, ...) {
68 va_start(ap, fmt); 68 va_start(ap, fmt);
69 vfprintf(stderr, fmt, ap); 69 vfprintf(stderr, fmt, ap);
70 va_end(ap); 70 va_end(ap);
71
72 if(fmt[strlen(fmt)-1] == ':') {
73 fputc(' ', stderr);
74 perror(NULL);
75 }
71 exit(EXIT_FAILURE); 76 exit(EXIT_FAILURE);
72} 77}
73 78
@@ -101,7 +106,7 @@ initdc(void) {
101 if(!setlocale(LC_CTYPE, "") || !XSupportsLocale()) 106 if(!setlocale(LC_CTYPE, "") || !XSupportsLocale())
102 weprintf("no locale support\n"); 107 weprintf("no locale support\n");
103 if(!(dc = calloc(1, sizeof *dc))) 108 if(!(dc = calloc(1, sizeof *dc)))
104 eprintf("cannot malloc %u bytes\n", sizeof *dc); 109 eprintf("cannot malloc %u bytes:", sizeof *dc);
105 if(!(dc->dpy = XOpenDisplay(NULL))) 110 if(!(dc->dpy = XOpenDisplay(NULL)))
106 eprintf("cannot open display\n"); 111 eprintf("cannot open display\n");
107 112