]> git.ozlabs.org Git - ccan/blobdiff - ccan/err/_info
ccan/err: new err.h-replacing module.
[ccan] / ccan / err / _info
diff --git a/ccan/err/_info b/ccan/err/_info
new file mode 100644 (file)
index 0000000..5a5752b
--- /dev/null
@@ -0,0 +1,37 @@
+#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.
+ *
+ * Example:
+ *     #include <ccan/err/err.h>
+ *
+ *     int main(int argc, char *argv[])
+ *     {
+ *             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;
+}