summaryrefslogtreecommitdiff
path: root/lib/ccan/err/_info
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2012-06-09 15:37:20 +0930
committerRusty Russell <rusty@rustcorp.com.au>2012-06-09 15:41:18 +0930
commitd9ce876ea97d59d66c8d2892b43b7cc8392470a0 (patch)
tree9b75e61a0b9ab13ee598369d4e59abcba5d4e29b /lib/ccan/err/_info
parent8a338c65a1824ae8a93bef7bc8fac65684c285c8 (diff)
downloadsamba-d9ce876ea97d59d66c8d2892b43b7cc8392470a0.tar.gz
samba-d9ce876ea97d59d66c8d2892b43b7cc8392470a0.tar.bz2
samba-d9ce876ea97d59d66c8d2892b43b7cc8392470a0.zip
ccan: import err module.from ccan revision 5add556a1cb64b49a664506aa76216d885b22c97
This allows us to avoid err.h in failtest. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/ccan/err/_info')
-rw-r--r--lib/ccan/err/_info41
1 files changed, 41 insertions, 0 deletions
diff --git a/lib/ccan/err/_info b/lib/ccan/err/_info
new file mode 100644
index 0000000000..97bc0f9ed4
--- /dev/null
+++ b/lib/ccan/err/_info
@@ -0,0 +1,41 @@
+#include <stdio.h>
+#include <string.h>
+#include "config.h"
+
+/**
+ * err - err(), errx(), warn() and warnx(), as per BSD's err.h.
+ *
+ * A few platforms don't provide err.h; for those, this provides replacements.
+ * For most, it simple includes the system err.h.
+ *
+ * Unfortunately, you have to call err_set_progname() to tell the replacements
+ * your program name, otherwise it prints "unknown program".
+ *
+ * Example:
+ * #include <ccan/err/err.h>
+ *
+ * int main(int argc, char *argv[])
+ * {
+ * err_set_progname(argv[0]);
+ * if (argc != 1)
+ * errx(1, "Expect no arguments");
+ * exit(0);
+ * }
+ *
+ * License: Public domain
+ * Author: Rusty Russell <rusty@rustcorp.com.au>
+ */
+int main(int argc, char *argv[])
+{
+ if (argc != 2)
+ return 1;
+
+ if (strcmp(argv[1], "depends") == 0) {
+#if !HAVE_ERR_H
+ printf("ccan/compiler\n");
+#endif
+ return 0;
+ }
+
+ return 1;
+}