intl.c 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  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. #include <stdlib.h>
  21. #include <string.h>
  22. #include <errno.h>
  23. #undef __OPTIMIZE__
  24. #include <libintl.h>
  25. /**********************************************************************/
  26. #ifdef L_gettext
  27. char *gettext(const char *msgid)
  28. {
  29. return (char *) msgid;
  30. }
  31. #endif
  32. /**********************************************************************/
  33. #ifdef L_dgettext
  34. char *__dgettext(const char *domainname,
  35. const char *msgid)
  36. {
  37. return (char *) msgid;
  38. }
  39. weak_alias (__dgettext, dgettext)
  40. #endif
  41. /**********************************************************************/
  42. #ifdef L_dcgettext
  43. char * __dcgettext(const char *domainname,
  44. const char *msgid, int category)
  45. {
  46. return (char *) msgid;
  47. }
  48. weak_alias (__dcgettext, dcgettext)
  49. #endif
  50. /**********************************************************************/
  51. #ifdef L_ngettext
  52. char *ngettext(const char *msgid1, const char *msgid2,
  53. unsigned long int n)
  54. {
  55. return (char *) ((n == 1) ? msgid1 : msgid2);
  56. }
  57. #endif
  58. /**********************************************************************/
  59. #ifdef L_dngettext
  60. char *dngettext(const char *domainname, const char *msgid1,
  61. const char *msgid2, unsigned long int n)
  62. {
  63. return (char *) ((n == 1) ? msgid1 : msgid2);
  64. }
  65. #endif
  66. /**********************************************************************/
  67. #ifdef L_dcngettext
  68. char *dcngettext(const char *domainname, const char *msgid1,
  69. const char *msgid2, unsigned long int n,
  70. int category)
  71. {
  72. return (char *) ((n == 1) ? msgid1 : msgid2);
  73. }
  74. #endif
  75. /**********************************************************************/
  76. #ifdef L_textdomain
  77. char *textdomain(const char *domainname)
  78. {
  79. static const char default_str[] = "messages";
  80. if (domainname && *domainname && strcmp(domainname, default_str)) {
  81. __set_errno(EINVAL);
  82. return NULL;
  83. }
  84. return (char *) default_str;
  85. }
  86. #endif
  87. /**********************************************************************/
  88. #ifdef L_bindtextdomain
  89. char *bindtextdomain(const char *domainname, const char *dirname)
  90. {
  91. static const char dir[] = "/";
  92. if (!domainname || !*domainname
  93. || (dirname
  94. #if 1
  95. && ((dirname[0] != '/') || dirname[1])
  96. #else
  97. && strcmp(dirname, dir)
  98. #endif
  99. )
  100. ) {
  101. __set_errno(EINVAL);
  102. return NULL;
  103. }
  104. return (char *) dir;
  105. }
  106. #endif
  107. /**********************************************************************/
  108. #ifdef L_bind_textdomain_codeset
  109. /* Specify the character encoding in which the messages from the
  110. DOMAINNAME message catalog will be returned. */
  111. char *bind_textdomain_codeset(const char *domainname,
  112. const char *codeset)
  113. {
  114. if (!domainname || !*domainname || codeset) {
  115. __set_errno(EINVAL);
  116. }
  117. return NULL;
  118. }
  119. #endif
  120. /**********************************************************************/
  121. #ifdef L__nl_expand_alias
  122. /* glibc-ism */
  123. const char *_nl_expand_alias(const char * name)
  124. {
  125. return NULL; /* uClibc does not support locale aliases. */
  126. }
  127. #endif
  128. /**********************************************************************/
  129. #ifdef L__nl_msg_cat_cntr
  130. /* glibc-ism */
  131. int _nl_msg_cat_cntr = 0;
  132. #endif
  133. /**********************************************************************/