Added support for reading from stdin with '-' as file name arg.
authorMark Whitley <markw@lineo.com>
Wed, 28 Jun 2000 22:55:59 +0000 (22:55 -0000)
committerMark Whitley <markw@lineo.com>
Wed, 28 Jun 2000 22:55:59 +0000 (22:55 -0000)
findutils/grep.c
grep.c

index a374e114dfa6844f770a008d66319794171691a4..ac55f19d1f925ffb63eff5bef44b463e1622ae90 100644 (file)
@@ -167,7 +167,7 @@ extern int grep_main(int argc, char **argv)
 
        /* If no files were specified, take input from stdin. Otherwise, we grep
         * through all the files specified. */
-       if (argv[optind+1] == NULL) {
+       if (argv[optind+1] == NULL || (strcmp(argv[optind+1], "-") == 0)) {
                grep_file(stdin);
        } else {
                int i;
diff --git a/grep.c b/grep.c
index a374e114dfa6844f770a008d66319794171691a4..ac55f19d1f925ffb63eff5bef44b463e1622ae90 100644 (file)
--- a/grep.c
+++ b/grep.c
@@ -167,7 +167,7 @@ extern int grep_main(int argc, char **argv)
 
        /* If no files were specified, take input from stdin. Otherwise, we grep
         * through all the files specified. */
-       if (argv[optind+1] == NULL) {
+       if (argv[optind+1] == NULL || (strcmp(argv[optind+1], "-") == 0)) {
                grep_file(stdin);
        } else {
                int i;