]> git.ozlabs.org Git - ccan/blob - ccan/err/_info
64cc2cef01d80579bb57d6c47c751902c5ef6a30
[ccan] / ccan / err / _info
1 #include <stdio.h>
2 #include <string.h>
3 #include "config.h"
4
5 /**
6  * err - err(), errx(), warn() and warnx(), as per BSD's err.h.
7  *
8  * A few platforms don't provide err.h; for those, this provides replacements.
9  * For most, it simple includes the system err.h.
10  *
11  * Unfortunately, you have to call err_set_progname() to tell the replacements
12  * your program name, otherwise it prints "unknown program".
13  *
14  * Example:
15  *      #include <ccan/err/err.h>
16  *
17  *      int main(int argc, char *argv[])
18  *      {
19  *              err_set_progname(argv[0]);
20  *              if (argc != 1)
21  *                      errx(1, "Expect no arguments");
22  *              exit(0);
23  *      }
24  *
25  * License: CC0 (Public domain)
26  * Author: Rusty Russell <rusty@rustcorp.com.au>
27  */
28 int main(int argc, char *argv[])
29 {
30         if (argc != 2)
31                 return 1;
32
33         if (strcmp(argv[1], "depends") == 0) {
34 #if !HAVE_ERR_H
35                 printf("ccan/compiler\n");
36 #endif
37                 return 0;
38         }
39
40         return 1;
41 }