/* * Copyright © 2023 Nick Bowler * * Stub gettext macros for test purposes. * * License WTFPL2: Do What The Fuck You Want To Public License, version 2. * This is free software: you are free to do what the fuck you want to. * There is NO WARRANTY, to the extent permitted by law. */ #ifndef TEST_NLS_GETTEXT_H_ #define TEST_NLS_GETTEXT_H_ #include #include /* * We don't need a real snprintf for testing help functionality; substitute * using vsprintf to ease testing on C89 implementations. */ #define help_do_snprintf help_do_snprintf static inline int help_do_snprintf(char *buf, size_t n, const char *fmt, ...) { va_list ap; int ret; va_start(ap, fmt); ret = vsprintf(buf, fmt, ap); va_end(ap); return ret; } /* * Do nothing, but try to tickle a crash if a bogus string argument is * passed as the real functions dereference the provided pointers. */ #define gettext(s) (*(volatile char *)s, s) #define pgettext_expr(c, s) (*(volatile char *)c + *(volatile char *)s, s) #endif