I'm trying to recode ls
program (man ls). If ls has no arguments and it's output is redirected trough pipe like ls > file
than it'll use -1
flag.
Which function i must use, to find that output is redirected?
Asked
Active
Viewed 51 times
0

Vladimir
- 294
- 1
- 3
- 10
-
1This? https://unix.stackexchange.com/a/227065/303077 – Matej Jan 31 '19 at 18:33
-
"redirected through pipe" is completely incorrect. There is absolutely no pipe involved with `ls > file`. Try writing some code that does `fseek(stdout, ..)` and run it with stdout redirected to a file. – William Pursell Jan 31 '19 at 18:48