commit - 703f0cd0ff2254a2ef0cce93f5e372eb21f40870
commit + 840c16f685ca8f617270f33af0525ae7bff5adc1
blob - f67a5b0a6cc854b0d52a66c6a1fcef8c199648d4
blob + a280019360db62b26e5dc841f132285d69717351
--- xitems.c
+++ xitems.c
/* die -- print formatted string, and exit with the status eval. */
static void
die(int eval, const char *fmt, ...)
+{
+ fputs(PROGNAME ": ", stderr);
+ if (fmt) {
+ va_list argp;
+ va_start(argp, fmt);
+ vfprintf(stderr, fmt, argp);
+ va_end(argp);
+ }
+ fputc('\n', stderr);
+ exit(eval);
+}
+
+/* edie -- same as die(), but also output a message via strerror(). */
+static void
+edie(int eval, const char *fmt, ...)
{
+ int xerrno = errno;
+
fputs(PROGNAME ": ", stderr);
if (fmt) {
va_list argp;
vfprintf(stderr, fmt, argp);
va_end(argp);
}
+ fprintf(stderr, ": %s", strerror(xerrno));
+
fputc('\n', stderr);
exit(eval);
}
if (!(dpy = XOpenDisplay(NULL)))
die(1, "couldn't open display");
+
+#ifdef __OpenBSD__
+ /* Xlib needs rpath at runtime. */
+ if (pledge("stdio rpath", NULL) == -1)
+ edie(1, "pledge");
+#endif
+
screen = DefaultScreen(dpy);
if (!o_bg)