From 02bee574acb67bd41069455ef495970fb7621e9b Mon Sep 17 00:00:00 2001 From: Charles Levert Date: Fri, 11 Nov 2005 10:21:25 +0000 Subject: * 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. --- src/search.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') 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) -- cgit v1.2.1