]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(decode_switches): Clean up last change.
authorJim Meyering <jim@meyering.net>
Sun, 21 Apr 1996 04:07:41 +0000 (04:07 +0000)
committerJim Meyering <jim@meyering.net>
Sun, 21 Apr 1996 04:07:41 +0000 (04:07 +0000)
[posix_pedantic]: Don't consider TABSIZE environment variable.

src/ls.c

index 1a1ebbc06ab0ea925793d2fb91dd13da4713950c..8b524d95496662ab809c4dc17fa09fd51ab16c17 100644 (file)
--- 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,