1 #ifndef IPUTILS_COMMON_H
2 #define IPUTILS_COMMON_H
7 #define ARRAY_SIZE(arr) \
8 (sizeof(arr) / sizeof((arr)[0]) + \
9 sizeof(__typeof__(int[1 - 2 * \
10 !!__builtin_types_compatible_p(__typeof__(arr), \
11 __typeof__(&arr[0]))])) * 0)
14 # define iputils_attribute_format(t, n, m) __attribute__((__format__ (t, n, m)))
16 # define iputils_attribute_format(t, n, m)
19 #if defined(USE_IDN) || defined(ENABLE_NLS)
25 # define _(Text) gettext (Text)
27 # undef bindtextdomain
28 # define bindtextdomain(Domain, Directory) /* empty */
30 # define textdomain(Domain) /* empty */
39 # define AI_IDN 0x0040
42 # define AI_CANONIDN 0x0080
47 #endif /* #ifdef USE_IDN */
50 # define SOL_IPV6 IPPROTO_IPV6
52 #ifndef IP_PMTUDISC_DO
53 # define IP_PMTUDISC_DO 2
55 #ifndef IPV6_PMTUDISC_DO
56 # define IPV6_PMTUDISC_DO 2
62 extern void error(int status, int errnum, const char *format, ...);
65 extern int close_stream(FILE *stream);
66 extern void close_stdout(void);
67 extern long strtol_or_err(char const *const str, char const *const errmesg,
68 const long min, const long max);
69 extern void iputils_srand(void);
70 extern void timespecsub(struct timespec *a, struct timespec *b,
71 struct timespec *res);
73 #endif /* IPUTILS_COMMON_H */