diff options
author | Jim Meyering <jim@meyering.net> | 1996-04-21 04:07:41 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1996-04-21 04:07:41 +0000 |
commit | ee708ff4aaf7ecf857431955a10600cd5be7774f (patch) | |
tree | 5f70b9a40a55055bb8c4ed0155638f627e6fc789 /src | |
parent | c1f1f8ac3a0c2b8bb68bc0b9b629276bb745138f (diff) | |
download | coreutils-ee708ff4aaf7ecf857431955a10600cd5be7774f.tar.xz |
(decode_switches): Clean up last change.
[posix_pedantic]: Don't consider TABSIZE environment variable.
Diffstat (limited to 'src')
-rw-r--r-- | src/ls.c | 48 |
1 files changed, 25 insertions, 23 deletions
@@ -702,18 +702,20 @@ decode_switches (int argc, char **argv) ignore_patterns = 0; quote_as_string = 0; - p = getenv ("COLUMNS"); - if (xstrtol (p, NULL, 0, &tmp_long, NULL) == LONGINT_OK - && 0 < tmp_long && tmp_long <= INT_MAX) + line_length = 80; + if ((p = getenv ("COLUMNS"))) { - line_length = (int) tmp_long; - } - else - { - error (0, 0, - _("ignoring invalid width in enironment variable COLUMNS: %s"), - p); - line_length = 80; + if (xstrtol (p, NULL, 0, &tmp_long, NULL) == LONGINT_OK + && 0 < tmp_long && tmp_long <= INT_MAX) + { + line_length = (int) tmp_long; + } + else + { + error (0, 0, + _("ignoring invalid width in enironment variable COLUMNS: %s"), + p); + } } #ifdef TIOCGWINSZ @@ -725,20 +727,20 @@ decode_switches (int argc, char **argv) } #endif - /* FIXME: reference TABSIZE iff !posix_pedantic. */ - p = getenv ("TABSIZE"); - - if (xstrtol (p, NULL, 0, &tmp_long, NULL) == LONGINT_OK - && 0 < tmp_long && tmp_long <= INT_MAX) + tabsize = 8; + if (!posix_pedantic && (p = getenv ("TABSIZE"))) { - tabsize = (int) tmp_long; - } - else - { - error (0, 0, + if (xstrtol (p, NULL, 0, &tmp_long, NULL) == LONGINT_OK + && 0 < tmp_long && tmp_long <= INT_MAX) + { + tabsize = (int) tmp_long; + } + else + { + error (0, 0, _("ignoring invalid tab size in enironment variable TABSIZE: %s"), - p); - tabsize = 8; + p); + } } while ((c = getopt_long (argc, argv, |