diff options
author | Connor Lane Smith <cls@lubutu.com> | 2010-06-24 14:22:34 +0100 |
---|---|---|
committer | Connor Lane Smith <cls@lubutu.com> | 2010-06-24 14:22:34 +0100 |
commit | 6c1d0e4d60b239e9533def6feaf8eb2138858c3e (patch) | |
tree | 710f1366ba2cbb4bce0cf2cc0ac7d6bdd0ddfdf0 /draw.c | |
parent | 6efe1932be9425896c34f54501a6194286dd0503 (diff) |
fixed offsets, updated eprint, cleaned up
Diffstat (limited to 'draw.c')
-rw-r--r-- | draw.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -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; } |