Added support for reading from stdin with '-' as file name arg.

This commit is contained in:
Mark Whitley 2000-06-28 22:55:59 +00:00
parent 1ca41775bb
commit 8bd891cbec
2 changed files with 2 additions and 2 deletions

View 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;

2
grep.c
View 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;