PageRenderTime 30ms CodeModel.GetById 32ms RepoModel.GetById 0ms app.codeStats 0ms

/package/mkpasswd/utils.h

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