Added support for ignoring '-g' per GNU ls, thanks to David Vrabel
[oweals/busybox.git] / grep.c
diff --git a/grep.c b/grep.c
index a374e114dfa6844f770a008d66319794171691a4..a2e2ff813e20e596e004e4fcd2c682a640e541a5 100644 (file)
--- a/grep.c
+++ b/grep.c
@@ -165,9 +165,9 @@ extern int grep_main(int argc, char **argv)
        if ((argc-1) - (optind+1) > 0)
                print_filename++;
 
-       /* If no files were specified, take input from stdin. Otherwise, we grep
-        * through all the files specified. */
-       if (argv[optind+1] == NULL) {
+       /* If no files were specified, or '-' was specified, take input from
+        * stdin. Otherwise, we grep through all the files specified. */
+       if (argv[optind+1] == NULL || (strcmp(argv[optind+1], "-") == 0)) {
                grep_file(stdin);
        } else {
                int i;