1 #ifndef WHOIS_UTILS_H 2 #define WHOIS_UTILS_H 3 4 /* Convenience macros */ 5 #define streq(a, b) (strcmp(a, b) == 0) 6 #define strcaseeq(a, b) (strcasecmp(a, b) == 0) 7 #define strneq(a, b, n) (strncmp(a, b, n) == 0) 8 #define strncaseeq(a, b, n) (strncasecmp(a, b, n) == 0) 9 10 #define NOFAIL(ptr) do_nofail((ptr), __FILE__, __LINE__) 11 12 /* Portability macros */ 13 #ifdef __GNUC__ 14 # define NORETURN __attribute__((noreturn)) 15 #else 16 # define NORETURN 17 #endif 18 19 #ifndef AI_IDN 20 # define AI_IDN 0 21 #endif 22 23 #ifndef AI_ADDRCONFIG 24 # define AI_ADDRCONFIG 0 25 #endif 26 27 #ifdef HAVE_GETOPT_LONG 28 # define GETOPT_LONGISH(c, v, o, l, i) getopt_long(c, v, o, l, i) 29 #else 30 # define GETOPT_LONGISH(c, v, o, l, i) getopt(c, v, o) 31 #endif 32 33 #ifdef ENABLE_NLS 34 # include <libintl.h> 35 # include <locale.h> 36 # define _(a) (gettext(a)) 37 # ifdef gettext_noop 38 # define N_(a) gettext_noop(a) 39 # else 40 # define N_(a) (a) 41 # endif 42 #else 43 # define _(a) (a) 44 # define N_(a) (a) 45 # define ngettext(a, b, c) ((c==1) ? (a) : (b)) 46 #endif 47 48 49 /* Prototypes */ 50 void *do_nofail(void *ptr, const char *file, const int line); 51 char **merge_args(char *args, char *argv[], int *argc); 52 53 void err_quit(const char *fmt, ...) NORETURN; 54 void err_sys(const char *fmt, ...) NORETURN; 55 56 #endif 57