k9core

Coreutils for *nix operating systems
git clone git://bvnf.space/k9core.git
Log | Files | Refs | LICENSE

commit ddbfa39a1819f200ceff231ac0104e452f33438d
parent 845e90bbe2645ffbbd6562e848ddbd7a5da8968d
Author: aabacchus <ben@bvnf.space>
Date:   Mon, 13 Sep 2021 15:00:37 +0100

ls: separate by \n if stdout is not a tty

Diffstat:
Msrc/ls.c | 3++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/ls.c b/src/ls.c @@ -5,6 +5,7 @@ #include <stdio.h> #include <string.h> #include <sys/stat.h> +#include <unistd.h> int recursive_list_dirs(const char *directory) @@ -75,7 +76,7 @@ main(int argc, char *argv[]) char suffix, separator; suffix = separator = 0; - if(!show_line /* && STDOUT_FILENO is a tty */) + if(!show_line && isatty(STDOUT_FILENO)) separator = ' '; else separator = '\n';