summaryrefslogtreecommitdiff
path: root/lib/ccan/err/_info
blob: 97bc0f9ed4ff03437804b2928326aa040d3e5665 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#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.
 *
 * Unfortunately, you have to call err_set_progname() to tell the replacements
 * your program name, otherwise it prints "unknown program".
 *
 * Example:
 *	#include <ccan/err/err.h>
 *
 *	int main(int argc, char *argv[])
 *	{
 *		err_set_progname(argv[0]);
 *		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;
}