diff options
author | Bruno Haible <bruno@clisp.org> | 2010-11-20 18:54:00 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2010-11-20 18:54:00 +0100 |
commit | 63bc47a1fecb6e16b620d95fc6f5313f317bb550 (patch) | |
tree | 14b82933f36d88f7b4c80e86ec9bc02e5a1cf163 /lib/striconveh.c | |
parent | 1756f0d25b6b53905697246f71e1575a906a0cea (diff) | |
download | gnulib-63bc47a1fecb6e16b620d95fc6f5313f317bb550.tar.gz |
Port to uClibc.
* lib/relocatable.c (find_shared_library_fullname): Treat uClibc like
glibc.
* lib/strerror_r.c: Likewise.
* m4/arpa_inet_h.m4 (gl_HEADER_ARPA_INET): Likewise.
* m4/duplocale.m4 (gl_FUNC_DUPLOCALE): Likewise.
* m4/fsusage.m4 (gl_FILE_SYSTEM_USAGE): Likewise.
* m4/glibc21.m4 (gl_GLIBC21): Likewise.
* tests/test-sigaction.c (handler, main): Likewise.
* lib/localename.c (gl_locale_name_thread_unsafe, HAVE_LOCALE_NULL):
Treat uClibc like a non-glibc platform.
* lib/propername.c (proper_name_utf8): Likewise.
* lib/spawn.in.h: Likewise.
* lib/striconv.c (mem_cd_iconv, str_cd_iconv, str_iconv): Likewise.
* lib/striconveh.c (iconveh_open, iconv_carefully, iconv_carefully_1,
mem_cd_iconveh_internal): Likewise.
* lib/striconveha.c (mem_iconveha, str_iconveha): Likewise.
* lib/string.in.h (memchr, memrchr, rawmemchr, strchrnul, strpbrk,
strstr, strcasestr): Likewise.
* lib/unicodeio.c (unicode_to_mb): Likewise.
* m4/getdelim.m4 (gl_FUNC_GETDELIM): Likewise.
* m4/getline.m4 (gl_FUNC_GETLINE): Likewise.
* m4/glibc2.m4 (gt_GLIBC2): Likewise.
* m4/iconv_open.m4 (gl_FUNC_ICONV_OPEN): Likewise.
* m4/memmem.m4 (gl_FUNC_MEMMEM_SIMPLE, gl_FUNC_MEMMEM): Likewise.
* m4/printf.m4 (gl_PRINTF_DIRECTIVE_A): Likewise.
* m4/strcasestr.m4 (gl_FUNC_STRCASESTR_SIMPLE, gl_FUNC_STRCASESTR):
Likewise.
* m4/strstr.m4 (gl_FUNC_STRSTR_SIMPLE, gl_FUNC_STRSTR): Likewise.
* m4/strtod.m4 (gl_FUNC_STRTOD): Likewise.
* m4/sys_ioctl_h.m4 (gl_SYS_IOCTL_H): Likewise.
* m4/sys_select_h.m4 (gl_HEADER_SYS_SELECT): Likewise.
* m4/sys_socket_h.m4 (gl_HEADER_SYS_SOCKET): Likewise.
* m4/sys_times_h.m4 (gl_SYS_TIMES_H): Likewise.
* m4/unistd_h.m4 (gl_UNISTD_H): Likewise.
* m4/wchar_h.m4 (gl_WCHAR_H): Likewise.
* tests/test-getopt.h (OPTIND_MIN): Likewise.
* tests/test-striconveha.c (main): Likewise.
* doc/posix-functions/getdelim.texi: Mention an uClibc bug.
* doc/posix-functions/getline.texi: Likewise.
Reported by Mike Frysinger <vapier@gentoo.org>.
Diffstat (limited to 'lib/striconveh.c')
-rw-r--r-- | lib/striconveh.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/lib/striconveh.c b/lib/striconveh.c index 8d73d291fb..efbbe72f50 100644 --- a/lib/striconveh.c +++ b/lib/striconveh.c @@ -52,7 +52,8 @@ iconveh_open (const char *to_codeset, const char *from_codeset, iconveh_t *cdp) iconv_t cd2; /* Avoid glibc-2.1 bug with EUC-KR. */ -# if (__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) && !defined _LIBICONV_VERSION +# if ((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \ + && !defined _LIBICONV_VERSION if (c_strcasecmp (from_codeset, "EUC-KR") == 0 || c_strcasecmp (to_codeset, "EUC-KR") == 0) { @@ -79,7 +80,9 @@ iconveh_open (const char *to_codeset, const char *from_codeset, iconveh_t *cdp) } if (STRCASEEQ (to_codeset, "UTF-8", 'U','T','F','-','8',0,0,0,0) -# if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2 || _LIBICONV_VERSION >= 0x0105 +# if (((__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2) || __GLIBC__ > 2) \ + && !defined __UCLIBC__) \ + || _LIBICONV_VERSION >= 0x0105 || c_strcasecmp (to_codeset, "UTF-8//TRANSLIT") == 0 # endif ) @@ -136,7 +139,7 @@ iconveh_close (const iconveh_t *cd) /* iconv_carefully is like iconv, except that it stops as soon as it encounters a conversion error, and it returns in *INCREMENTED a boolean telling whether it has incremented the input pointers past the error location. */ -# if !defined _LIBICONV_VERSION && !defined __GLIBC__ +# if !defined _LIBICONV_VERSION && !(defined __GLIBC__ && !defined __UCLIBC__) /* Irix iconv() inserts a NUL byte if it cannot convert. NetBSD iconv() inserts a question mark if it cannot convert. Only GNU libiconv and GNU libc are known to prefer to fail rather @@ -244,7 +247,7 @@ iconv_carefully_1 (iconv_t cd, *inbuf = inptr; *inbytesleft = inptr_end - inptr; -# if !defined _LIBICONV_VERSION && !defined __GLIBC__ +# if !defined _LIBICONV_VERSION && !(defined __GLIBC__ && !defined __UCLIBC__) /* Irix iconv() inserts a NUL byte if it cannot convert. NetBSD iconv() inserts a question mark if it cannot convert. Only GNU libiconv and GNU libc are known to prefer to fail rather @@ -403,7 +406,8 @@ mem_cd_iconveh_internal (const char *src, size_t srclen, /* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug. */ # if defined _LIBICONV_VERSION \ - || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun) + || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \ + || defined __sun) /* Set to the initial state. */ iconv (cd, NULL, NULL, NULL, NULL); # endif @@ -531,7 +535,8 @@ mem_cd_iconveh_internal (const char *src, size_t srclen, /* Now get the conversion state back to the initial state. But avoid glibc-2.1 bug and Solaris 2.7 bug. */ #if defined _LIBICONV_VERSION \ - || !((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) || defined __sun) + || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \ + || defined __sun) for (;;) { char *outptr = result + length; @@ -606,7 +611,8 @@ mem_cd_iconveh_internal (const char *src, size_t srclen, /* Avoid glibc-2.1 bug and Solaris 2.7-2.9 bug. */ # if defined _LIBICONV_VERSION \ - || !((__GLIBC__ - 0 == 2 && __GLIBC_MINOR__ - 0 <= 1) || defined __sun) + || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \ + || defined __sun) /* Set to the initial state. */ if (cd1 != (iconv_t)(-1)) iconv (cd1, NULL, NULL, NULL, NULL); @@ -658,7 +664,8 @@ mem_cd_iconveh_internal (const char *src, size_t srclen, /* Now get the conversion state of CD1 back to the initial state. But avoid glibc-2.1 bug and Solaris 2.7 bug. */ # if defined _LIBICONV_VERSION \ - || !((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) || defined __sun) + || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \ + || defined __sun) if (cd1 != (iconv_t)(-1)) res1 = iconv (cd1, NULL, NULL, &out1ptr, &out1size); else @@ -740,7 +747,8 @@ mem_cd_iconveh_internal (const char *src, size_t srclen, /* Now get the conversion state of CD1 back to the initial state. But avoid glibc-2.1 bug and Solaris 2.7 bug. */ # if defined _LIBICONV_VERSION \ - || !((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) || defined __sun) + || !(((__GLIBC__ == 2 && __GLIBC_MINOR__ <= 1) && !defined __UCLIBC__) \ + || defined __sun) if (cd2 != (iconv_t)(-1)) res2 = iconv (cd2, NULL, NULL, &out2ptr, &out2size); else @@ -883,7 +891,7 @@ mem_cd_iconveh_internal (const char *src, size_t srclen, } length = out2ptr - result; } -# if !defined _LIBICONV_VERSION && !defined __GLIBC__ +# if !defined _LIBICONV_VERSION && !(defined __GLIBC__ && !defined __UCLIBC__) /* Irix iconv() inserts a NUL byte if it cannot convert. NetBSD iconv() inserts a question mark if it cannot convert. |