8 /* This is unnecessary with a real err.h. See below */
9 #define err_set_progname(name) ((void)name)
12 #include <ccan/compiler/compiler.h>
15 * err_set_progname - set the program name
16 * @name: the name to use for err, errx, warn and warnx
18 * The BSD err.h calls know the program name, unfortunately there's no
19 * portable way for the CCAN replacements to do that on other systems.
21 * If you don't call this with argv[0], it will be "unknown program".
24 * err_set_progname(argv[0]);
26 void err_set_progname(const char *name
);
29 * err - exit(eval) with message based on format and errno.
30 * @eval: the exit code
31 * @fmt: the printf-style format string
33 * The format string is printed to stderr like so:
34 * <executable name>: <format>: <strerror(errno)>\n
37 * char *p = strdup("hello");
39 * err(1, "Failed to strdup 'hello'");
41 void NORETURN
err(int eval
, const char *fmt
, ...);
44 * errx - exit(eval) with message based on format.
45 * @eval: the exit code
46 * @fmt: the printf-style format string
48 * The format string is printed to stderr like so:
49 * <executable name>: <format>\n
53 * errx(1, "I don't expect any arguments");
55 void NORETURN
errx(int eval
, const char *fmt
, ...);
58 * warn - print a message to stderr based on format and errno.
59 * @eval: the exit code
60 * @fmt: the printf-style format string
62 * The format string is printed to stderr like so:
63 * <executable name>: <format>: <strerror(errno)>\n
66 * char *p = strdup("hello");
68 * warn("Failed to strdup 'hello'");
70 void warn(const char *fmt
, ...);
73 * warnx - print a message to stderr based on format.
74 * @eval: the exit code
75 * @fmt: the printf-style format string
77 * The format string is printed to stderr like so:
78 * <executable name>: <format>\n
82 * warnx("I don't expect any arguments (ignoring)");
84 void warnx(const char *fmt
, ...);
87 #endif /* CCAN_ERR_H */