intl.c 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. * Supply some strongs for use by strerror*(), etc.
  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. libc_hidden_proto(strcmp)
  29. /**********************************************************************/
  30. #ifdef L___uClibc_dgettext
  31. char *__uClibc_dgettext(const char *domainname,
  32. const char *msgid)
  33. {
  34. return (char *) msgid;
  35. }
  36. strong_alias(__uClibc_dgettext, __dgettext)
  37. #endif
  38. /**********************************************************************/
  39. #ifdef L___uClibc_dcgettext
  40. char *__uClibc_dcgettext(const char *domainname,
  41. const char *msgid, int category)
  42. {
  43. return (char *) msgid;
  44. }
  45. strong_alias(__uClibc_dcgettext, __dcgettext)
  46. #endif
  47. /**********************************************************************/
  48. #ifdef L___uClibc_textdomain
  49. char *__uClibc_textdomain(const char *domainname)
  50. {
  51. static const char default_str[] = "messages";
  52. if (domainname && *domainname && strcmp(domainname, default_str)) {
  53. __set_errno(EINVAL);
  54. return NULL;
  55. }
  56. return (char *) default_str;
  57. }
  58. strong_alias(__uClibc_textdomain, __textdomain)
  59. #endif
  60. /**********************************************************************/
  61. #ifdef L___uClibc_bindtextdomain
  62. char *__uClibc_bindtextdomain(const char *domainname, const char *dirname)
  63. {
  64. static const char dir[] = "/";
  65. if (!domainname || !*domainname
  66. || (dirname
  67. #if 1
  68. && ((dirname[0] != '/') || dirname[1])
  69. #else
  70. && strcmp(dirname, dir)
  71. #endif
  72. )
  73. ) {
  74. __set_errno(EINVAL);
  75. return NULL;
  76. }
  77. return (char *) dir;
  78. }
  79. strong_alias(__uClibc_bindtextdomain, __bindtextdomain)
  80. #endif
  81. /**********************************************************************/