[hackers] [dmenu] helpful errors || Connor Lane Smith

From: <hg_AT_suckless.org>
Date: Fri, 6 May 2011 22:13:09 +0200 (CEST)

changeset: 388:1bdb44c8ac89
tag: tip
user: Connor Lane Smith <cls_AT_lubutu.com>
date: Fri May 06 21:13:02 2011 +0100
files: dmenu.c draw.c
description:
helpful errors

diff -r 018a60a404ea -r 1bdb44c8ac89 dmenu.c
--- a/dmenu.c Thu May 05 15:46:48 2011 +0100
+++ b/dmenu.c Fri May 06 21:13:02 2011 +0100
@@ -440,9 +440,9 @@
                 if((p = strchr(buf, '\n')))
                         *p = '\0';
                 if(!(item = calloc(1, sizeof *item)))
- eprintf("cannot malloc %u bytes\n", sizeof *item);
+ eprintf("cannot malloc %u bytes:", sizeof *item);
                 if(!(item->text = strdup(buf)))
- eprintf("cannot strdup %u bytes\n", strlen(buf)+1);
+ eprintf("cannot strdup %u bytes:", strlen(buf)+1);
                 inputw = MAX(inputw, textw(dc, item->text));
         }
 }
diff -r 018a60a404ea -r 1bdb44c8ac89 draw.c
--- a/draw.c Thu May 05 15:46:48 2011 +0100
+++ b/draw.c Fri May 06 21:13:02 2011 +0100
@@ -68,6 +68,11 @@
         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");
 
Received on Fri May 06 2011 - 22:13:09 CEST

This archive was generated by hypermail 2.2.0 : Fri May 06 2011 - 22:24:04 CEST