void-packages/srcpkgs/man-db/patches/guard-glibc-iconv-ext.patch

60 lines
2.0 KiB
Diff

src/manconv.c | 7 ++++++-
src/manconv_client.c | 4 ++++
src/whatis.c | 4 ++++
3 files changed, 14 insertions(+), 1 deletion(-)
diff --git src/manconv.c src/manconv.c
index b9ac8d3a..8f5bdaee 100644
--- src/manconv.c
+++ src/manconv.c
@@ -111,9 +111,14 @@ static int try_iconv (pipeline *p, const char *try_from_code, const char *to,
iconv_t cd_utf8, cd = NULL;
bool to_utf8 = STREQ (try_to_code, "UTF-8") ||
STRNEQ (try_to_code, "UTF-8//", 7);
- const char *utf8_target = last ? "UTF-8//IGNORE" : "UTF-8";
bool ignore_errors = (strstr (try_to_code, "//IGNORE") != NULL);
int ret = 0;
+#ifdef __GLIBC__
+ const char *utf8_target = last ? "UTF-8//IGNORE" : "UTF-8";
+#else /* __GLIBC__ */
+ const char *utf8_target = "UTF-8";
+ last = false;
+#endif /* ! __GLIBC__ */
debug ("trying encoding %s -> %s\n", try_from_code, try_to_code);
diff --git src/manconv_client.c src/manconv_client.c
index 0c41bec6..2a7f1398 100644
--- src/manconv_client.c
+++ src/manconv_client.c
@@ -102,7 +102,11 @@ void add_manconv (pipeline *p, const char *source, const char *target)
gl_list_add_last (codes->from, xstrdup (source));
name = appendstr (name, "UTF-8:", source, (void *) 0);
}
+#ifdef __GLIBC__
codes->to = xasprintf ("%s//IGNORE", target);
+#else /* __GLIBC__ */
+ codes->to = xasprintf ("%s", target);
+#endif /* ! __GLIBC__ */
/* informational only; no shell quoting concerns */
name = appendstr (name, " -t ", codes->to, (void *) 0);
if (quiet >= 2)
diff --git src/whatis.c src/whatis.c
index d2559169..ec80c117 100644
--- src/whatis.c
+++ src/whatis.c
@@ -945,9 +945,13 @@ int main (int argc, char *argv[])
display_seen = new_string_set (GL_HASH_SET);
#ifdef HAVE_ICONV
+#ifdef __GLIBC__
locale_charset = xasprintf ("%s//IGNORE", get_locale_charset ());
conv_to_locale = iconv_open (locale_charset, "UTF-8");
free (locale_charset);
+#else /* __GLIBC__ */
+ conv_to_locale = iconv_open(get_locale_charset (), "UTF-8");
+#endif /* ! __GLIBC__ */
#endif /* HAVE_ICONV */
if (regex_opt) {