summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1996-04-21 04:07:41 +0000
committerJim Meyering <jim@meyering.net>1996-04-21 04:07:41 +0000
commitee708ff4aaf7ecf857431955a10600cd5be7774f (patch)
tree5f70b9a40a55055bb8c4ed0155638f627e6fc789
parentc1f1f8ac3a0c2b8bb68bc0b9b629276bb745138f (diff)
downloadcoreutils-ee708ff4aaf7ecf857431955a10600cd5be7774f.tar.xz
(decode_switches): Clean up last change.
[posix_pedantic]: Don't consider TABSIZE environment variable.
-rw-r--r--src/ls.c48
1 files changed, 25 insertions, 23 deletions
diff --git a/src/ls.c b/src/ls.c
index 1a1ebbc06..8b524d954 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -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,