intl.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /* Copyright (C) 2003 Manuel Novoa III
  2. * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
  3. *
  4. * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
  5. */
  6. /*
  7. * Stub version of libintl.
  8. *
  9. * Aug 30, 2003
  10. * Add some hidden names to support locale-enabled libstd++.
  11. */
  12. #include <stdlib.h>
  13. #include <string.h>
  14. #include <errno.h>
  15. #undef __OPTIMIZE__
  16. #include <libintl.h>
  17. /**********************************************************************/
  18. #ifdef L_gettext
  19. char *gettext(const char *msgid)
  20. {
  21. return (char *) msgid;
  22. }
  23. #endif
  24. /**********************************************************************/
  25. #ifdef L_dgettext
  26. char *__dgettext(const char *domainname,
  27. const char *msgid)
  28. {
  29. return (char *) msgid;
  30. }
  31. strong_alias(__dgettext, dgettext)
  32. #endif
  33. /**********************************************************************/
  34. #ifdef L_dcgettext
  35. char *__dcgettext(const char *domainname,
  36. const char *msgid, int category)
  37. {
  38. return (char *) msgid;
  39. }
  40. strong_alias(__dcgettext, dcgettext)
  41. #endif
  42. /**********************************************************************/
  43. #ifdef L_ngettext
  44. char *ngettext(const char *msgid1, const char *msgid2,
  45. unsigned long int n)
  46. {
  47. return (char *) ((n == 1) ? msgid1 : msgid2);
  48. }
  49. #endif
  50. /**********************************************************************/
  51. #ifdef L_dngettext
  52. char *dngettext(const char *domainname, const char *msgid1,
  53. const char *msgid2, unsigned long int n)
  54. {
  55. return (char *) ((n == 1) ? msgid1 : msgid2);
  56. }
  57. #endif
  58. /**********************************************************************/
  59. #ifdef L_dcngettext
  60. char *dcngettext(const char *domainname, const char *msgid1,
  61. const char *msgid2, unsigned long int n,
  62. int category)
  63. {
  64. return (char *) ((n == 1) ? msgid1 : msgid2);
  65. }
  66. #endif
  67. /**********************************************************************/
  68. #ifdef L_textdomain
  69. char *__textdomain(const char *domainname)
  70. {
  71. static const char default_str[] = "messages";
  72. if (domainname && *domainname && strcmp(domainname, default_str)) {
  73. __set_errno(EINVAL);
  74. return NULL;
  75. }
  76. return (char *) default_str;
  77. }
  78. strong_alias(__textdomain, textdomain)
  79. #endif
  80. /**********************************************************************/
  81. #ifdef L_bindtextdomain
  82. char *__bindtextdomain(const char *domainname, const char *dirname)
  83. {
  84. static const char dir[] = "/";
  85. if (!domainname || !*domainname
  86. || (dirname
  87. #if 1
  88. && ((dirname[0] != '/') || dirname[1])
  89. #else
  90. && strcmp(dirname, dir)
  91. #endif
  92. )
  93. ) {
  94. __set_errno(EINVAL);
  95. return NULL;
  96. }
  97. return (char *) dir;
  98. }
  99. strong_alias(__bindtextdomain, bindtextdomain)
  100. #endif
  101. /**********************************************************************/
  102. #ifdef L_bind_textdomain_codeset
  103. /* Specify the character encoding in which the messages from the
  104. DOMAINNAME message catalog will be returned. */
  105. char *bind_textdomain_codeset(const char *domainname,
  106. const char *codeset)
  107. {
  108. if (!domainname || !*domainname || codeset) {
  109. __set_errno(EINVAL);
  110. }
  111. return NULL;
  112. }
  113. #endif
  114. /**********************************************************************/
  115. #ifdef L__nl_expand_alias
  116. /* glibc-ism */
  117. const char *_nl_expand_alias(const char * name)
  118. {
  119. return NULL; /* uClibc does not support locale aliases. */
  120. }
  121. #endif
  122. /**********************************************************************/
  123. #ifdef L__nl_msg_cat_cntr
  124. /* glibc-ism */
  125. int _nl_msg_cat_cntr = 0;
  126. #endif
  127. /**********************************************************************/