From 09196004812cdc0ac6aa2329e314a7e7bf6d6256 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 10 May 2003 13:30:26 +0000 Subject: [PATCH] (main): Test for the case of no arguments before computing n_files. --- src/tail.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/tail.c b/src/tail.c index e69470c24..c91b8d83f 100644 --- a/src/tail.c +++ b/src/tail.c @@ -1624,10 +1624,13 @@ main (int argc, char **argv) --n_units; } - n_files = argc - optind; - file = argv + optind; - if (n_files == 0) + if (optind < argc) + { + n_files = argc - optind; + file = argv + optind; + } + else { static char *dummy_stdin = "-"; n_files = 1; -- 2.34.1