aboutsummaryrefslogtreecommitdiffstats
path: root/util/strgutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/strgutil.c')
-rw-r--r--util/strgutil.c47
1 files changed, 39 insertions, 8 deletions
diff --git a/util/strgutil.c b/util/strgutil.c
index 515132f95..5389d0694 100644
--- a/util/strgutil.c
+++ b/util/strgutil.c
@@ -1,6 +1,6 @@
/* strgutil.c - string utilities
* Copyright (C) 1994, 1998, 1999, 2000, 2001,
- * 2003 Free Software Foundation, Inc.
+ * 2003, 2004, 2005 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@@ -453,10 +453,33 @@ static void
handle_iconv_error (const char *to, const char *from, int use_fallback)
{
if (errno == EINVAL)
- log_info (_("conversion from `%s' to `%s' not available\n"),
- from, to);
+ {
+ static int shown1, shown2;
+ int x;
+
+ if (to && !strcmp (to, "utf-8"))
+ {
+ x = shown1;
+ shown1 = 1;
+ }
+ else
+ {
+ x = shown2;
+ shown2 = 1;
+ }
+
+ if (!x)
+ log_info (_("conversion from `%s' to `%s' not available\n"),
+ from, to);
+ }
else
- log_info (_("iconv_open failed: %s\n"), strerror (errno));
+ {
+ static int shown;
+
+ if (!shown)
+ log_info (_("iconv_open failed: %s\n"), strerror (errno));
+ shown = 1;
+ }
if (use_fallback)
{
@@ -706,8 +729,12 @@ native_to_utf8( const char *string )
if ( iconv (cd, (ICONV_CONST char **)&inptr, &inbytes,
&outptr, &outbytes) == (size_t)-1)
{
- log_info (_("conversion from `%s' to `%s' failed: %s\n"),
- active_charset_name, "utf-8", strerror (errno));
+ static int shown;
+
+ if (!shown)
+ log_info (_("conversion from `%s' to `%s' failed: %s\n"),
+ active_charset_name, "utf-8", strerror (errno));
+ shown = 1;
/* We don't do any conversion at all but use the strings as is. */
strcpy (buffer, string);
}
@@ -980,8 +1007,12 @@ utf8_to_native( const char *string, size_t length, int delim )
outbuf = outptr = m_alloc (outbytes);
if ( iconv (cd, (ICONV_CONST char **)&inptr, &inbytes,
&outptr, &outbytes) == (size_t)-1) {
- log_info (_("conversion from `%s' to `%s' failed: %s\n"),
- "utf-8", active_charset_name, strerror (errno));
+ static int shown;
+
+ if (!shown)
+ log_info (_("conversion from `%s' to `%s' failed: %s\n"),
+ "utf-8", active_charset_name, strerror (errno));
+ shown = 1;
/* Didn't worked out. Temporary disable the use of
* iconv and fall back to our old code. */
m_free (buffer);