From 6c1d0e4d60b239e9533def6feaf8eb2138858c3e Mon Sep 17 00:00:00 2001 From: Connor Lane Smith Date: Thu, 24 Jun 2010 14:22:34 +0100 Subject: fixed offsets, updated eprint, cleaned up --- draw.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'draw.c') diff --git a/draw.c b/draw.c index 688bd69..6791b97 100644 --- a/draw.c +++ b/draw.c @@ -13,6 +13,9 @@ #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) ? (a) : (b)) +/* variables */ +char *progname; + void drawcleanup(void) { if(dc.font.set) @@ -71,6 +74,7 @@ void eprint(const char *errstr, ...) { va_list ap; + fprintf(stderr, "%s: ", progname); va_start(ap, errstr); vfprintf(stderr, errstr, ap); va_end(ap); @@ -83,7 +87,7 @@ getcolor(const char *colstr) { XColor color; if(!XAllocNamedColor(dpy, cmap, colstr, &color, &color)) - eprint("drawtext: cannot allocate color '%s'\n", colstr); + eprint("cannot allocate color '%s'\n", colstr); return color.pixel; } @@ -92,8 +96,8 @@ initfont(const char *fontstr) { char *def, **missing = NULL; int i, n; - if(!fontstr || fontstr[0] == '\0') - eprint("drawtext: cannot load font: '%s'\n", fontstr); + if(!fontstr || !*fontstr) + eprint("cannot load null font\n"); dc.font.set = XCreateFontSet(dpy, fontstr, &missing, &n, &def); if(missing) XFreeStringList(missing); @@ -111,7 +115,7 @@ initfont(const char *fontstr) { else { if(!(dc.font.xfont = XLoadQueryFont(dpy, fontstr)) && !(dc.font.xfont = XLoadQueryFont(dpy, "fixed"))) - eprint("drawtext: cannot load font: '%s'\n", fontstr); + eprint("cannot load font '%s'\n", fontstr); dc.font.ascent = dc.font.xfont->ascent; dc.font.descent = dc.font.xfont->descent; } -- cgit v1.2.3-13-gbd6f