intl.c 3.3 KB

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