summaryrefslogtreecommitdiff
path: root/src/ls.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1993-07-24 13:00:24 +0000
committerJim Meyering <jim@meyering.net>1993-07-24 13:00:24 +0000
commit08701d38a4c4e746e79132651c4577a6c03b02f6 (patch)
tree7c692ae4719304c8ca74572944ac5a87c7677f70 /src/ls.c
parent75dd04102776a59adda1c9747dfc0152de3c34b5 (diff)
downloadcoreutils-08701d38a4c4e746e79132651c4577a6c03b02f6.tar.xz
merge with 3.8
Diffstat (limited to 'src/ls.c')
-rw-r--r--src/ls.c50
1 files changed, 30 insertions, 20 deletions
diff --git a/src/ls.c b/src/ls.c
index 6dd186a38..e659260e3 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -45,6 +45,8 @@
#include <getopt.h>
#include "system.h"
#include <fnmatch.h>
+
+#include "ls.h"
#include "version.h"
#ifndef S_IEXEC
@@ -525,29 +527,37 @@ decode_switches (argc, argv)
/* initialize all switches to default settings */
-#ifdef MULTI_COL
- /* This is for the `dir' program. */
- format = many_per_line;
- quote_funny_chars = 1;
-#else
-#ifdef LONG_FORMAT
- /* This is for the `vdir' program. */
- format = long_format;
- quote_funny_chars = 1;
-#else
- /* This is for the `ls' program. */
- if (isatty (1))
+ switch (ls_mode)
{
+ case LS_MULTI_COL:
+ /* This is for the `dir' program. */
format = many_per_line;
- qmark_funny_chars = 1;
- }
- else
- {
- format = one_per_line;
- qmark_funny_chars = 0;
+ quote_funny_chars = 1;
+ break;
+
+ case LS_LONG_FORMAT:
+ /* This is for the `vdir' program. */
+ format = long_format;
+ quote_funny_chars = 1;
+ break;
+
+ case LS_LS:
+ /* This is for the `ls' program. */
+ if (isatty (1))
+ {
+ format = many_per_line;
+ qmark_funny_chars = 1;
+ }
+ else
+ {
+ format = one_per_line;
+ qmark_funny_chars = 0;
+ }
+ break;
+
+ default:
+ abort ();
}
-#endif
-#endif
time_type = time_mtime;
full_time = 0;