diff options
author | Peter Korsgaard <jacmet@sunsite.dk> | 2013-08-31 23:32:29 +0200 |
---|---|---|
committer | Peter Korsgaard <jacmet@sunsite.dk> | 2013-08-31 23:32:29 +0200 |
commit | 91141b141190b481422b7aea56e8f4d265c44e88 (patch) | |
tree | 9348d1efe1cd68f40e350b3b0b26d2ae102272dc /package/mkpasswd/utils.h | |
parent | 7b48cee91f9acdf46a27440ee2a44acf8fa63040 (diff) | |
parent | 90fb70b4c37ad3a3178b51c7941881aa8dfd8fa6 (diff) | |
download | buildroot-91141b141190b481422b7aea56e8f4d265c44e88.tar.gz buildroot-91141b141190b481422b7aea56e8f4d265c44e88.zip |
Merge branch 'next'
Diffstat (limited to 'package/mkpasswd/utils.h')
-rw-r--r-- | package/mkpasswd/utils.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/package/mkpasswd/utils.h b/package/mkpasswd/utils.h new file mode 100644 index 0000000000..0f226aee2f --- /dev/null +++ b/package/mkpasswd/utils.h @@ -0,0 +1,56 @@ +#ifndef WHOIS_UTILS_H +#define WHOIS_UTILS_H + +/* Convenience macros */ +#define streq(a, b) (strcmp(a, b) == 0) +#define strcaseeq(a, b) (strcasecmp(a, b) == 0) +#define strneq(a, b, n) (strncmp(a, b, n) == 0) +#define strncaseeq(a, b, n) (strncasecmp(a, b, n) == 0) + +#define NOFAIL(ptr) do_nofail((ptr), __FILE__, __LINE__) + +/* Portability macros */ +#ifdef __GNUC__ +# define NORETURN __attribute__((noreturn)) +#else +# define NORETURN +#endif + +#ifndef AI_IDN +# define AI_IDN 0 +#endif + +#ifndef AI_ADDRCONFIG +# define AI_ADDRCONFIG 0 +#endif + +#ifdef HAVE_GETOPT_LONG +# define GETOPT_LONGISH(c, v, o, l, i) getopt_long(c, v, o, l, i) +#else +# define GETOPT_LONGISH(c, v, o, l, i) getopt(c, v, o) +#endif + +#ifdef ENABLE_NLS +# include <libintl.h> +# include <locale.h> +# define _(a) (gettext(a)) +# ifdef gettext_noop +# define N_(a) gettext_noop(a) +# else +# define N_(a) (a) +# endif +#else +# define _(a) (a) +# define N_(a) (a) +# define ngettext(a, b, c) ((c==1) ? (a) : (b)) +#endif + + +/* Prototypes */ +void *do_nofail(void *ptr, const char *file, const int line); +char **merge_args(char *args, char *argv[], int *argc); + +void err_quit(const char *fmt, ...) NORETURN; +void err_sys(const char *fmt, ...) NORETURN; + +#endif |