about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-07-17 17:45:03 +0000
committerUlrich Drepper <drepper@redhat.com>2004-07-17 17:45:03 +0000
commit1b6840e5acb99031f96544551b021acc74273738 (patch)
tree9cba471d6b841f14b6dcf7f58e35653a86ce2a51
parent77d60040fe62a09c8e9c71f44c2e3d4dc42dab51 (diff)
downloadglibc-1b6840e5acb99031f96544551b021acc74273738.tar.gz
glibc-1b6840e5acb99031f96544551b021acc74273738.tar.xz
glibc-1b6840e5acb99031f96544551b021acc74273738.zip
Update.
2004-07-17  Ulrich Drepper  <drepper@redhat.com>

	* iconv/iconv_prog.c (print_known_names): Make machine-readable
	output even less cluttered.
-rw-r--r--ChangeLog5
-rw-r--r--iconv/iconv_prog.c16
2 files changed, 12 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 46a4c2b606..c1962a1c17 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2004-07-17  Ulrich Drepper  <drepper@redhat.com>
+
+	* iconv/iconv_prog.c (print_known_names): Make machine-readable
+	output even less cluttered.
+
 2004-07-16  Steven Munroe  <sjmunroe@us.ibm.com>
 
 	[BZ #269]
diff --git a/iconv/iconv_prog.c b/iconv/iconv_prog.c
index af823255b2..26b3c24f31 100644
--- a/iconv/iconv_prog.c
+++ b/iconv/iconv_prog.c
@@ -770,7 +770,10 @@ print_known_names (void)
 	add_known_names (modules);
     }
 
-  fputs (_("\
+  bool human_readable = isatty (fileno (stdout));
+
+  if (human_readable)
+    fputs (_("\
 The following list contain all the coded character sets known.  This does\n\
 not necessarily mean that all combinations of these names can be used for\n\
 the FROM and TO command line parameters.  One coded character set can be\n\
@@ -778,13 +781,8 @@ listed with several different names (aliases).\n\n  "), stdout);
 
   /* Now print the collected names.  */
   column = 2;
-  if (isatty (fileno (stdout)))
-    {
-      twalk (printlist, do_print_human);
+  twalk (printlist, human_readable ? do_print_human : do_print);
 
-      if (column != 0)
-	puts ("");
-    }
-  else
-    twalk (printlist, do_print);
+  if (human_readable && column != 0)
+    puts ("");
 }