diff options
-rw-r--r-- | findutils/grep.c | 6 | ||||
-rw-r--r-- | grep.c | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/findutils/grep.c b/findutils/grep.c index 05bf8b8cf..8d2c915be 100644 --- a/findutils/grep.c +++ b/findutils/grep.c | |||
@@ -141,8 +141,10 @@ extern int grep_main(int argc, char **argv) | |||
141 | if (argv[optind] == NULL) | 141 | if (argv[optind] == NULL) |
142 | usage(grep_usage); | 142 | usage(grep_usage); |
143 | 143 | ||
144 | /* compile the regular expression */ | 144 | /* compile the regular expression |
145 | reflags = REG_NOSUB; /* we're not going to mess with sub-expressions */ | 145 | * we're not going to mess with sub-expressions, and we need to |
146 | * treat newlines right. */ | ||
147 | reflags = REG_NOSUB | REG_NEWLINE; | ||
146 | if (ignore_case) | 148 | if (ignore_case) |
147 | reflags |= REG_ICASE; | 149 | reflags |= REG_ICASE; |
148 | if ((ret = regcomp(®ex, argv[optind], reflags)) != 0) { | 150 | if ((ret = regcomp(®ex, argv[optind], reflags)) != 0) { |
@@ -141,8 +141,10 @@ extern int grep_main(int argc, char **argv) | |||
141 | if (argv[optind] == NULL) | 141 | if (argv[optind] == NULL) |
142 | usage(grep_usage); | 142 | usage(grep_usage); |
143 | 143 | ||
144 | /* compile the regular expression */ | 144 | /* compile the regular expression |
145 | reflags = REG_NOSUB; /* we're not going to mess with sub-expressions */ | 145 | * we're not going to mess with sub-expressions, and we need to |
146 | * treat newlines right. */ | ||
147 | reflags = REG_NOSUB | REG_NEWLINE; | ||
146 | if (ignore_case) | 148 | if (ignore_case) |
147 | reflags |= REG_ICASE; | 149 | reflags |= REG_ICASE; |
148 | if ((ret = regcomp(®ex, argv[optind], reflags)) != 0) { | 150 | if ((ret = regcomp(®ex, argv[optind], reflags)) != 0) { |