Skip to content

Commit 026827f

Browse files
committed
die() consistency: always add newline
1 parent d14670b commit 026827f

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

dmenu.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ grabkeyboard(void)
187187
return;
188188
nanosleep(&ts, NULL);
189189
}
190-
die("cannot grab keyboard\n");
190+
die("cannot grab keyboard");
191191
}
192192

193193
static void
@@ -205,7 +205,7 @@ match(void)
205205
/* separate input text into tokens to be matched individually */
206206
for (s = strtok(buf, " "); s; tokv[tokc - 1] = s, s = strtok(NULL, " "))
207207
if (++tokc > tokn && !(tokv = realloc(tokv, ++tokn * sizeof *tokv)))
208-
die("cannot realloc %u bytes\n", tokn * sizeof *tokv);
208+
die("cannot realloc %u bytes:", tokn * sizeof *tokv);
209209
len = tokc ? strlen(tokv[0]) : 0;
210210

211211
matches = lprefix = lsubstr = matchend = prefixend = substrend = NULL;
@@ -647,14 +647,14 @@ main(int argc, char *argv[])
647647
if (!setlocale(LC_CTYPE, "") || !XSupportsLocale())
648648
fputs("warning: no locale support\n", stderr);
649649
if (!(dpy = XOpenDisplay(NULL)))
650-
die("cannot open display\n");
650+
die("cannot open display");
651651
screen = DefaultScreen(dpy);
652652
root = RootWindow(dpy, screen);
653653
sw = DisplayWidth(dpy, screen);
654654
sh = DisplayHeight(dpy, screen);
655655
drw = drw_create(dpy, screen, root, sw, sh);
656656
if (!drw_fontset_create(drw, fonts, LENGTH(fonts)))
657-
die("no fonts could be loaded.\n");
657+
die("no fonts could be loaded.");
658658
lrpad = drw->fonts->h;
659659

660660
if (fast) {

drw.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ xfont_create(Drw *drw, const char *fontname, FcPattern *fontpattern)
129129
return NULL;
130130
}
131131
} else {
132-
die("no font specified.\n");
132+
die("no font specified.");
133133
}
134134

135135
font = ecalloc(1, sizeof(Fnt));
@@ -188,7 +188,7 @@ drw_clr_create(Drw *drw, Clr *dest, const char *clrname)
188188
if (!XftColorAllocName(drw->dpy, DefaultVisual(drw->dpy, drw->screen),
189189
DefaultColormap(drw->dpy, drw->screen),
190190
clrname, dest))
191-
die("error, cannot allocate color '%s'\n", clrname);
191+
die("error, cannot allocate color '%s'", clrname);
192192
}
193193

194194
/* Wrapper to create color schemes. The caller has to call free(3) on the
@@ -331,7 +331,7 @@ drw_text(Drw *drw, int x, int y, unsigned int w, unsigned int h, unsigned int lp
331331

332332
if (!drw->fonts->pattern) {
333333
/* Refer to the comment in xfont_create for more information. */
334-
die("the first font in the cache must be loaded from a font string.\n");
334+
die("the first font in the cache must be loaded from a font string.");
335335
}
336336

337337
fcpattern = FcPatternDuplicate(drw->fonts->pattern);

util.c

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ die(const char *fmt, ...) {
2727
if (fmt[0] && fmt[strlen(fmt)-1] == ':') {
2828
fputc(' ', stderr);
2929
perror(NULL);
30+
} else {
31+
fputc('\n', stderr);
3032
}
3133

3234
exit(1);

0 commit comments

Comments
 (0)