summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharles Levert <charles_levert@gna.org>2005-11-11 10:21:25 +0000
committerCharles Levert <charles_levert@gna.org>2005-11-11 10:21:25 +0000
commit02bee574acb67bd41069455ef495970fb7621e9b (patch)
tree91410f41618ef0af2f8b4151f14b0f7cfe44c889 /src
parentd5601840ae754a6a13ea7b06ef2089ee412224c4 (diff)
downloadgrep-02bee574acb67bd41069455ef495970fb7621e9b.tar.gz
* src/search.c (Pcompile): Abort in error if -P and multiple patterns
are specified, with an error message explaining the situation. Fixing this won't be simple; the '\n' characters separating the patterns cannot just be replaced by '|' to create an alternation as back-references are assumed to be local to each individual pattern.
Diffstat (limited to 'src')
-rw-r--r--src/search.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/search.c b/src/search.c
index 206260d7..a7708641 100644
--- a/src/search.c
+++ b/src/search.c
@@ -627,9 +627,11 @@ COMPILE_FCT(Pcompile)
char const *p;
char const *pnul;
- /* FIXME: Remove this restriction. */
+ /* FIXME: Remove these restrictions. */
if (eolbyte != '\n')
error (2, 0, _("The -P and -z options cannot be combined"));
+ if (memchr(pattern, '\n', size))
+ error (2, 0, _("The -P option only supports a single pattern"));
*n = '\0';
if (match_lines)