summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2019-09-20 17:02:29 -0400
committerJakob Kaivo <jkk@ung.org>2019-09-20 17:02:29 -0400
commit1f74d59ba485b13ae1b3b3f92cf8a7791cc80f96 (patch)
treeb33d835957ac798b89f1a152e0e05ddbf62f0b43
parenta0b6d46ba7ee686c42fe04bf7028c9e6a58d6722 (diff)
format one entry per line if stdout is not a tty
-rw-r--r--ls.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ls.c b/ls.c
index feeccb7..d15288f 100644
--- a/ls.c
+++ b/ls.c
@@ -17,6 +17,7 @@
*
*/
+#define _XOPEN_SOURCE 700
#include <stdio.h>
#include <sys/stat.h>
#include <unistd.h>
@@ -541,6 +542,10 @@ main (int argc, char **argv)
return 1;
}
}
+
+ if (!isatty(STDOUT_FILENO)) {
+ display = SINGLE;
+ }
if (optind >= argc) {
strcpy(dirlist[0].path, ".");