1 /* CC0 (Public domain) - see LICENSE file for details */
9 /* This is unnecessary with a real err.h. See below */
10 #define err_set_progname(name) ((void)name)
13 #include <ccan/compiler/compiler.h>
16 * err_set_progname - set the program name
17 * @name: the name to use for err, errx, warn and warnx
19 * The BSD err.h calls know the program name, unfortunately there's no
20 * portable way for the CCAN replacements to do that on other systems.
22 * If you don't call this with argv[0], it will be "unknown program".
25 * err_set_progname(argv[0]);
27 void err_set_progname(const char *name);
30 * err - exit(eval) with message based on format and errno.
31 * @eval: the exit code
32 * @fmt: the printf-style format string
34 * The format string is printed to stderr like so:
35 * <executable name>: <format>: <strerror(errno)>\n
38 * char *p = strdup("hello");
40 * err(1, "Failed to strdup 'hello'");
42 void NORETURN err(int eval, const char *fmt, ...);
45 * errx - exit(eval) with message based on format.
46 * @eval: the exit code
47 * @fmt: the printf-style format string
49 * The format string is printed to stderr like so:
50 * <executable name>: <format>\n
54 * errx(1, "I don't expect any arguments");
56 void NORETURN errx(int eval, const char *fmt, ...);
59 * warn - print a message to stderr based on format and errno.
60 * @eval: the exit code
61 * @fmt: the printf-style format string
63 * The format string is printed to stderr like so:
64 * <executable name>: <format>: <strerror(errno)>\n
67 * char *p = strdup("hello");
69 * warn("Failed to strdup 'hello'");
71 void warn(const char *fmt, ...);
74 * warnx - print a message to stderr based on format.
75 * @eval: the exit code
76 * @fmt: the printf-style format string
78 * The format string is printed to stderr like so:
79 * <executable name>: <format>\n
83 * warnx("I don't expect any arguments (ignoring)");
85 void warnx(const char *fmt, ...);
88 #endif /* CCAN_ERR_H */