From d1de4a16ad662bdd8e26da5662a5b0678ce4995e Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 21 Sep 2000 02:39:50 +0000 Subject: [PATCH] Handle 'cat -' --- cat.c | 7 +++---- coreutils/cat.c | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/cat.c b/cat.c index 6a9204fe7..d47f814cf 100644 --- a/cat.c +++ b/cat.c @@ -31,11 +31,10 @@ extern int cat_main(int argc, char **argv) exit(TRUE); } - if (**(argv + 1) == '-') - usage(cat_usage); - while (--argc > 0) { - if (print_file_by_name(*++argv) == FALSE) { + if(!(strcmp(*++argv, "-"))) { + print_file(stdin); + } else if (print_file_by_name(*argv) == FALSE) { perror(*argv); exit(FALSE); } diff --git a/coreutils/cat.c b/coreutils/cat.c index 6a9204fe7..d47f814cf 100644 --- a/coreutils/cat.c +++ b/coreutils/cat.c @@ -31,11 +31,10 @@ extern int cat_main(int argc, char **argv) exit(TRUE); } - if (**(argv + 1) == '-') - usage(cat_usage); - while (--argc > 0) { - if (print_file_by_name(*++argv) == FALSE) { + if(!(strcmp(*++argv, "-"))) { + print_file(stdin); + } else if (print_file_by_name(*argv) == FALSE) { perror(*argv); exit(FALSE); } -- 2.25.1