(main): Ignore -f if no file operand is specified

and standard input is a pipe.
This commit is contained in:
Paul Eggert 2004-07-22 20:54:04 +00:00
parent e5d9694985
commit 255eb9cf44

View File

@ -1687,6 +1687,15 @@ main (int argc, char **argv)
static char *dummy_stdin = "-";
n_files = 1;
file = &dummy_stdin;
/* POSIX says that -f is ignored if no file operand is specified
and standard input is a pipe. */
if (forever)
{
struct stat stats;
if (fstat (STDIN_FILENO, &stats) == 0 && S_ISFIFO (stats.st_mode))
forever = false;
}
}
{