helpful errors
Connor Lane Smith cls@lubutu.com
Fri, 06 May 2011 21:13:02 +0100
M
draw.c
→
draw.c
@@ -68,6 +68,11 @@ fprintf(stderr, "%s: ", progname);
va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); + + if(fmt[strlen(fmt)-1] == ':') { + fputc(' ', stderr); + perror(NULL); + } exit(EXIT_FAILURE); }@@ -101,7 +106,7 @@
if(!setlocale(LC_CTYPE, "") || !XSupportsLocale()) weprintf("no locale support\n"); if(!(dc = calloc(1, sizeof *dc))) - eprintf("cannot malloc %u bytes\n", sizeof *dc); + eprintf("cannot malloc %u bytes:", sizeof *dc); if(!(dc->dpy = XOpenDisplay(NULL))) eprintf("cannot open display\n");