]> git.ozlabs.org Git - ccan/blobdiff - ccan/err/err.h
opt: add allocator setting.
[ccan] / ccan / err / err.h
index da9ea0c5bd165a97183f78bbebf965c813184df6..23e7f0c4858ef78c566b0107663695eecc802a3a 100644 (file)
@@ -1,12 +1,31 @@
+/* CC0 (Public domain) - see LICENSE file for details */
 #ifndef CCAN_ERR_H
 #define CCAN_ERR_H
 #include "config.h"
 
 #if HAVE_ERR_H
 #include <err.h>
+
+/* This is unnecessary with a real err.h.  See below */
+#define err_set_progname(name) ((void)name)
+
 #else
 #include <ccan/compiler/compiler.h>
 
+/**
+ * err_set_progname - set the program name
+ * @name: the name to use for err, errx, warn and warnx
+ *
+ * The BSD err.h calls know the program name, unfortunately there's no
+ * portable way for the CCAN replacements to do that on other systems.
+ *
+ * If you don't call this with argv[0], it will be "unknown program".
+ *
+ * Example:
+ *     err_set_progname(argv[0]);
+ */
+void err_set_progname(const char *name);
+
 /**
  * err - exit(eval) with message based on format and errno.
  * @eval: the exit code