libintl.c 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* Copyright (C) 2003 Manuel Novoa III
  2. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  3. *
  4. * Trivial Stubs, Public Domain.
  5. */
  6. #include <stdlib.h>
  7. #include <string.h>
  8. #include <errno.h>
  9. char *gettext(const char *msgid)
  10. {
  11. return (char *) msgid;
  12. }
  13. char *dgettext(const char *domainname, const char *msgid)
  14. {
  15. (void) domainname;
  16. return (char *) msgid;
  17. }
  18. char *dcgettext(const char *domainname, const char *msgid, int category)
  19. {
  20. (void) domainname;
  21. (void) category;
  22. return (char *) msgid;
  23. }
  24. char *ngettext(const char *msgid1, const char *msgid2, unsigned long n)
  25. {
  26. return (char *) ((n == 1) ? msgid1 : msgid2);
  27. }
  28. char *dngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long n)
  29. {
  30. (void) domainname;
  31. return (char *) ((n == 1) ? msgid1 : msgid2);
  32. }
  33. char *dcngettext(const char *domainname, const char *msgid1, const char *msgid2, unsigned long n, int category)
  34. {
  35. (void) domainname;
  36. (void) category;
  37. return (char *) ((n == 1) ? msgid1 : msgid2);
  38. }
  39. char *textdomain(const char *domainname)
  40. {
  41. static const char default_str[] = "messages";
  42. if (domainname && *domainname && strcmp(domainname, default_str)) {
  43. errno = EINVAL;
  44. return NULL;
  45. }
  46. return (char *) default_str;
  47. }
  48. char *bindtextdomain(const char *domainname, const char *dirname)
  49. {
  50. static const char dir[] = "/";
  51. if (!domainname || !*domainname
  52. || (dirname && ((dirname[0] != '/') || dirname[1]))
  53. ) {
  54. errno = EINVAL;
  55. return NULL;
  56. }
  57. return (char *) dir;
  58. }
  59. char *bind_textdomain_codeset(const char *domainname, const char *codeset)
  60. {
  61. if (!domainname || !*domainname || (codeset && strcasecmp(codeset, "UTF-8"))) {
  62. errno = EINVAL;
  63. }
  64. return NULL;
  65. }
  66. /* trick configure tests checking for gnu libintl, as in the copy included in gdb */
  67. const char *_nl_expand_alias (void) { return NULL; }
  68. int _nl_msg_cat_cntr = 0;