]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Display the offending regular expression if an error is detected
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Mon, 12 Mar 2012 09:14:25 +0000 (10:14 +0100)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Mon, 12 Mar 2012 09:14:25 +0000 (10:14 +0100)
If a regular expression is invalid, the actual regular expression is displayed
in the error message in addition to the error message from libpcre. The user
will know what regular expression failed.

url.c

diff --git a/url.c b/url.c
index ec5b436306c3a1c07d78a280647524168ff611ff..3cdba7379fe02197c5cc83704275b04176e32190 100644 (file)
--- a/url.c
+++ b/url.c
@@ -490,7 +490,7 @@ static int Alias_StoreRegexp(char *buf)
        new_alias->Next=NULL;
        new_alias->Re=pcre_compile(buf,0,&PcreError,&ErrorOffset,NULL);
        if (new_alias->Re==NULL) {
-               debuga(_("Failed to compile the regular expression: %s\n"),PcreError);
+               debuga(_("Failed to compile the regular expression \"%s\": %s\n"),buf,PcreError);
                free(new_alias);
                return(-1);
        }