intl.c 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /* Copyright (C) 2003 Manuel Novoa III
  2. *
  3. * This library is free software; you can redistribute it and/or
  4. * modify it under the terms of the GNU Library General Public
  5. * License as published by the Free Software Foundation; either
  6. * version 2 of the License, or (at your option) any later version.
  7. *
  8. * This library is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. * Library General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU Library General Public
  14. * License along with this library; if not, write to the Free
  15. * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. */
  17. /*
  18. * Stub version of libintl.
  19. *
  20. * Aug 30, 2003
  21. * Add some hidden names to support locale-enabled libstd++.
  22. */
  23. #include <stdlib.h>
  24. #include <string.h>
  25. #include <errno.h>
  26. #undef __OPTIMIZE__
  27. #include <libintl.h>
  28. /**********************************************************************/
  29. #ifdef L_gettext
  30. char *gettext(const char *msgid)
  31. {
  32. return (char *) msgid;
  33. }
  34. #endif
  35. /**********************************************************************/
  36. #ifdef L_dgettext
  37. char *__dgettext(const char *domainname,
  38. const char *msgid)
  39. {
  40. return (char *) msgid;
  41. }
  42. strong_alias(__dgettext, dgettext)
  43. #endif
  44. /**********************************************************************/
  45. #ifdef L_dcgettext
  46. char *__dcgettext(const char *domainname,
  47. const char *msgid, int category)
  48. {
  49. return (char *) msgid;
  50. }
  51. strong_alias(__dcgettext, dcgettext)
  52. #endif
  53. /**********************************************************************/
  54. #ifdef L_ngettext
  55. char *ngettext(const char *msgid1, const char *msgid2,
  56. unsigned long int n)
  57. {
  58. return (char *) ((n == 1) ? msgid1 : msgid2);
  59. }
  60. #endif
  61. /**********************************************************************/
  62. #ifdef L_dngettext
  63. char *dngettext(const char *domainname, const char *msgid1,
  64. const char *msgid2, unsigned long int n)
  65. {
  66. return (char *) ((n == 1) ? msgid1 : msgid2);
  67. }
  68. #endif
  69. /**********************************************************************/
  70. #ifdef L_dcngettext
  71. char *dcngettext(const char *domainname, const char *msgid1,
  72. const char *msgid2, unsigned long int n,
  73. int category)
  74. {
  75. return (char *) ((n == 1) ? msgid1 : msgid2);
  76. }
  77. #endif
  78. /**********************************************************************/
  79. #ifdef L_textdomain
  80. char *__textdomain(const char *domainname)
  81. {
  82. static const char default_str[] = "messages";
  83. if (domainname && *domainname && strcmp(domainname, default_str)) {
  84. __set_errno(EINVAL);
  85. return NULL;
  86. }
  87. return (char *) default_str;
  88. }
  89. strong_alias(__textdomain, textdomain)
  90. #endif
  91. /**********************************************************************/
  92. #ifdef L_bindtextdomain
  93. char *__bindtextdomain(const char *domainname, const char *dirname)
  94. {
  95. static const char dir[] = "/";
  96. if (!domainname || !*domainname
  97. || (dirname
  98. #if 1
  99. && ((dirname[0] != '/') || dirname[1])
  100. #else
  101. && strcmp(dirname, dir)
  102. #endif
  103. )
  104. ) {
  105. __set_errno(EINVAL);
  106. return NULL;
  107. }
  108. return (char *) dir;
  109. }
  110. strong_alias(__bindtextdomain, bindtextdomain)
  111. #endif
  112. /**********************************************************************/
  113. #ifdef L_bind_textdomain_codeset
  114. /* Specify the character encoding in which the messages from the
  115. DOMAINNAME message catalog will be returned. */
  116. char *bind_textdomain_codeset(const char *domainname,
  117. const char *codeset)
  118. {
  119. if (!domainname || !*domainname || codeset) {
  120. __set_errno(EINVAL);
  121. }
  122. return NULL;
  123. }
  124. #endif
  125. /**********************************************************************/
  126. #ifdef L__nl_expand_alias
  127. /* glibc-ism */
  128. const char *_nl_expand_alias(const char * name)
  129. {
  130. return NULL; /* uClibc does not support locale aliases. */
  131. }
  132. #endif
  133. /**********************************************************************/
  134. #ifdef L__nl_msg_cat_cntr
  135. /* glibc-ism */
  136. int _nl_msg_cat_cntr = 0;
  137. #endif
  138. /**********************************************************************/