]> diplodocus.org Git - mdfrm/commitdiff
Lose err.h and implement err and errx on our own.
authorepg <>
Thu, 2 Jun 2005 00:00:58 +0000 (00:00 +0000)
committerepg <>
Thu, 2 Jun 2005 00:00:58 +0000 (00:00 +0000)
mdfrm.c

diff --git a/mdfrm.c b/mdfrm.c
index 66e1b6f..9436b5d 100644 (file)
--- a/mdfrm.c
+++ b/mdfrm.c
@@ -9,7 +9,7 @@
 
 #include <ctype.h>
 #include <dirent.h>
-#include <err.h>
+#include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -39,6 +39,34 @@ enum {
 
 static char ident[] = "$Id$";
 
+static void
+err(int exitcode, char *format, ...)
+{
+    va_list ap;
+
+    va_start(ap, format);
+    vfprintf(stderr, format, ap);
+    va_end(ap);
+
+    perror(" ");
+
+    exit(exitcode);
+}
+
+static void
+errx(int exitcode, char *format, ...)
+{
+    va_list ap;
+
+    va_start(ap, format);
+    vfprintf(stderr, format, ap);
+    va_end(ap);
+
+    fputs("\n", stderr);
+
+    exit(exitcode);
+}
+
 static void
 sanitize(char *str, size_t len)
 {