intl.c 2.5 KB

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