about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-04-20 17:33:29 +0000
committerUlrich Drepper <drepper@redhat.com>2001-04-20 17:33:29 +0000
commitb17c0a8e31fe9e99359b6a874008de7aba85d64e (patch)
treead98fd3294cfa032ecbe0289467723db6660e7c4
parentb8750342aae413d0892fb0ef4468e036aa65e646 (diff)
downloadglibc-b17c0a8e31fe9e99359b6a874008de7aba85d64e.tar.gz
glibc-b17c0a8e31fe9e99359b6a874008de7aba85d64e.tar.xz
glibc-b17c0a8e31fe9e99359b6a874008de7aba85d64e.zip
Update.
	* iconv/iconv_prog.c (print_known_names): If printing goes not to
	a tty print in a more machine-friendly way.
-rw-r--r--ChangeLog3
-rw-r--r--iconv/iconv_prog.c24
2 files changed, 23 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index ef4e0c0d1c..0dde120a30 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2001-04-20  Ulrich Drepper  <drepper@redhat.com>
 
+	* iconv/iconv_prog.c (print_known_names): If printing goes not to
+	a tty print in a more machine-friendly way.
+
 	* sysdeps/ieee754/ldbl-128/e_asinl.c: New file.
 	Contributed by Stephen L Moshier <moshier@mediaone.net>.
 
diff --git a/iconv/iconv_prog.c b/iconv/iconv_prog.c
index 24521c0631..c1f9984700 100644
--- a/iconv/iconv_prog.c
+++ b/iconv/iconv_prog.c
@@ -586,7 +586,7 @@ insert_print_list (const void *nodep, VISIT value, int level)
 }
 
 static void
-do_print  (const void *nodep, VISIT value, int level)
+do_print_human  (const void *nodep, VISIT value, int level)
 {
   if (value == leaf || value == postorder)
     {
@@ -628,6 +628,17 @@ do_print  (const void *nodep, VISIT value, int level)
 }
 
 static void
+do_print  (const void *nodep, VISIT value, int level)
+{
+  if (value == leaf || value == postorder)
+    {
+      const char *s = *(const char **) nodep;
+
+      puts (s);
+    }
+}
+
+static void
 internal_function
 add_known_names (struct gconv_module *node)
 {
@@ -672,8 +683,13 @@ listed with several different names (aliases).\n\n  "), stdout);
 
   /* Now print the collected names.  */
   column = 2;
-  twalk (printlist, do_print);
+  if (isatty (fileno (stdout)))
+    {
+      twalk (printlist, do_print_human);
 
-  if (column != 0)
-    puts ("");
+      if (column != 0)
+	puts ("");
+    }
+  else
+    twalk (printlist, do_print);
 }