diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-07-20 07:32:40 -0400 |
---|---|---|
committer | Austin Foxley <austinf@cetoncorp.com> | 2009-08-19 12:11:27 -0700 |
commit | 9bcaf7e9f4fa3cd2ca830647757ecda4679bbd6d (patch) | |
tree | 536bed9d1c3694b0ed807ce41598e92c5268c5ce /extra/scripts/unifdef.c | |
parent | d4a43dc35be7a3833fc543958b2907d301896eb2 (diff) | |
download | uClibc-alpine-9bcaf7e9f4fa3cd2ca830647757ecda4679bbd6d.tar.bz2 uClibc-alpine-9bcaf7e9f4fa3cd2ca830647757ecda4679bbd6d.tar.xz |
unifdef: implement err.h funcs locally
Since the err.h functions are optional in uClibc, make sure we can rebuild
ourselves if support is disabled.
URL: https://bugs.busybox.net/show_bug.cgi?id=257
Reported-by: Michael Deutschmann <michael@talamasca.ocis.net>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
Diffstat (limited to 'extra/scripts/unifdef.c')
-rw-r--r-- | extra/scripts/unifdef.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/extra/scripts/unifdef.c b/extra/scripts/unifdef.c index 5d1171e4d..abc39966c 100644 --- a/extra/scripts/unifdef.c +++ b/extra/scripts/unifdef.c @@ -63,8 +63,8 @@ __FBSDID("$FreeBSD: /repoman/r/ncvs/src/usr.bin/unifdef/unifdef.c,v 1.20 2005/05 * also make it possible to handle all "dodgy" directives correctly. */ +#include <errno.h> #include <ctype.h> -#include <err.h> #include <stdarg.h> #include <stdbool.h> #include <stdio.h> @@ -72,6 +72,12 @@ __FBSDID("$FreeBSD: /repoman/r/ncvs/src/usr.bin/unifdef/unifdef.c,v 1.20 2005/05 #include <string.h> #include <unistd.h> +/* Avoid err.h since uClibc can disable these things */ +#define vwarnx(fmt, args) ({ fprintf(stderr, "unifdef: "); vfprintf(stderr, fmt, args); fprintf(stderr, "\n"); }) +#define warnx(fmt, args...) fprintf(stderr, "unifdef: " fmt "\n", ## args) +#define errx(exit_code, fmt, args...) ({ warnx(fmt, ## args); exit(exit_code); }) +#define err(exit_code, fmt, args...) errx(exit_code, fmt ": %s", ## args, strerror(errno)) + size_t strlcpy(char *dst, const char *src, size_t siz); /* types of input lines: */ |