rendercheck: configure.ac main.c rendercheck.h tests.c

Alan Coopersmith alanc at kemper.freedesktop.org
Fri May 5 07:46:48 EEST 2006


 configure.ac  |    1 +
 main.c        |    1 -
 rendercheck.h |   18 ++++++++++++++++++
 tests.c       |    1 -
 4 files changed, 19 insertions(+), 2 deletions(-)

New commits:
diff-tree 60d23bc0d6b8dbefa0c03949bb1637970450e58e (from d51e519170bf912339afac89f25c1f7662a101a2)
Author: Alan Coopersmith <alanc at alf.(none)>
Date:   Thu May 4 21:46:39 2006 -0700

    Add fallback version of errx for platforms without errx/err.h

diff --git a/configure.ac b/configure.ac
index 39b759f..33e6b3e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -43,5 +43,6 @@ AC_SUBST(RC_LIBS)
 
 # Checks for header files.
 AC_HEADER_STDC
+AC_CHECK_HEADERS([err.h])
 
 AC_OUTPUT([Makefile])
diff --git a/main.c b/main.c
index ead6efa..a6b3961 100644
--- a/main.c
+++ b/main.c
@@ -23,7 +23,6 @@
 #include "rendercheck.h"
 #include <stdlib.h>
 #include <stdio.h>
-#include <err.h>
 #include <string.h>
 #include <getopt.h>
 
diff --git a/rendercheck.h b/rendercheck.h
index 1667f5a..f6d2629 100644
--- a/rendercheck.h
+++ b/rendercheck.h
@@ -22,6 +22,24 @@
 
 #include <X11/extensions/Xrender.h>
 
+#if HAVE_ERR_H
+# include <err.h>
+#else
+# include <stdarg.h>
+# include <stdio.h>
+# include <stdlib.h>
+static inline void errx(int eval, const char *fmt, ...) {
+    va_list args;
+
+    va_start(args, fmt);
+    fprintf(stderr, "Fatal Error: ");
+    fprintf(stderr, fmt, args);
+    fprintf(stderr, "\n", args);
+    va_end(args);
+    exit(eval);
+}
+#endif
+
 #define min(a, b) (a < b ? a : b)
 #define max(a, b) (a > b ? a : b)
 
diff --git a/tests.c b/tests.c
index 83c8436..4d189f9 100644
--- a/tests.c
+++ b/tests.c
@@ -24,7 +24,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <math.h>
-#include <err.h>
 
 #include "rendercheck.h"
 



More information about the xorg-commit mailing list