diff options
Diffstat (limited to 'iconv/iconv_prog.c')
-rw-r--r-- | iconv/iconv_prog.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/iconv/iconv_prog.c b/iconv/iconv_prog.c index 24521c0..c1f9984 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); } |