+/*
+ * Report an error and exit.
+ * Use it instead of err(3) to avoid linking-in stdio.
+ */
+static void
+errexit(const char *prog, const char *reason)
+{
+ char *errstr = strerror(errno);
+ write(STDERR_FILENO, prog, strlen(prog));
+ write(STDERR_FILENO, ": ", 2);
+ write(STDERR_FILENO, reason, strlen(reason));
+ write(STDERR_FILENO, ": ", 2);
+ write(STDERR_FILENO, errstr, strlen(errstr));
+ write(STDERR_FILENO, "\n", 1);
+ exit(1);
+}
+