summaryrefslogtreecommitdiff
path: root/lib/texpect/texpect.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/texpect/texpect.c')
-rw-r--r--lib/texpect/texpect.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/lib/texpect/texpect.c b/lib/texpect/texpect.c
index 9256b5ee31f..b553de8ca5c 100644
--- a/lib/texpect/texpect.c
+++ b/lib/texpect/texpect.c
@@ -56,7 +56,33 @@
#ifdef HAVE_ERR_H
#include <err.h>
#else
-#include <ccan/err/err.h>
+const char progname[] = "unknown program";
+
+static void err(int eval, const char *fmt, ...)
+{
+ int err_errno = errno;
+ va_list ap;
+
+ fprintf(stderr, "%s: ", progname);
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ fprintf(stderr, ": %s\n", strerror(err_errno));
+ exit(eval);
+}
+
+static void errx(int eval, const char *fmt, ...)
+{
+ va_list ap;
+
+ fprintf(stderr, "%s: ", progname);
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+ fprintf(stderr, "\n");
+ exit(eval);
+}
+
#endif
struct command {