helpful errors
cd3b4915
2 file(s) · +8 −3
| 440 | 440 | if((p = strchr(buf, '\n'))) |
|
| 441 | 441 | *p = '\0'; |
|
| 442 | 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 | 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 | 446 | inputw = MAX(inputw, textw(dc, item->text)); |
|
| 447 | 447 | } |
|
| 448 | 448 | } |
| 68 | 68 | va_start(ap, fmt); |
|
| 69 | 69 | vfprintf(stderr, fmt, ap); |
|
| 70 | 70 | va_end(ap); |
|
| 71 | + | ||
| 72 | + | if(fmt[strlen(fmt)-1] == ':') { |
|
| 73 | + | fputc(' ', stderr); |
|
| 74 | + | perror(NULL); |
|
| 75 | + | } |
|
| 71 | 76 | exit(EXIT_FAILURE); |
|
| 72 | 77 | } |
|
| 73 | 78 | ||
| 101 | 106 | if(!setlocale(LC_CTYPE, "") || !XSupportsLocale()) |
|
| 102 | 107 | weprintf("no locale support\n"); |
|
| 103 | 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 | 110 | if(!(dc->dpy = XOpenDisplay(NULL))) |
|
| 106 | 111 | eprintf("cannot open display\n"); |
|
| 107 | 112 | ||