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 #ifndef AFL_MODE
13 # define AFL_MODE 0
14 #endif
15 
16 /* Portability macros */
17 #ifdef __GNUC__
18 # define NORETURN __attribute__((noreturn))
19 #else
20 # define NORETURN
21 #endif
22 
23 #ifndef AI_IDN
24 # define AI_IDN 0
25 #endif
26 
27 #ifndef AI_ADDRCONFIG
28 # define AI_ADDRCONFIG 0
29 #endif
30 
31 #ifdef HAVE_GETOPT_LONG
32 # define GETOPT_LONGISH(c, v, o, l, i) getopt_long(c, v, o, l, i)
33 #else
34 # define GETOPT_LONGISH(c, v, o, l, i) getopt(c, v, o)
35 #endif
36 
37 #ifdef ENABLE_NLS
38 # include <libintl.h>
39 # include <locale.h>
40 # define _(a) (gettext(a))
41 # ifdef gettext_noop
42 #  define N_(a) gettext_noop(a)
43 # else
44 #  define N_(a) (a)
45 # endif
46 #else
47 # define _(a) (a)
48 # define N_(a) (a)
49 # define ngettext(a, b, c) ((c==1) ? (a) : (b))
50 #endif
51 
52 #if defined IDN2_VERSION_NUMBER && IDN2_VERSION_NUMBER < 0x00140000
53 # define IDN2_NONTRANSITIONAL IDN2_NFC_INPUT
54 #endif
55 
56 /* Prototypes */
57 void *do_nofail(void *ptr, const char *file, const int line);
58 char **merge_args(char *args, char *argv[], int *argc);
59 
60 void NORETURN err_quit(const char *fmt, ...);
61 void NORETURN err_sys(const char *fmt, ...);
62 
63 #endif
64