diff options
author | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2011-07-11 15:55:25 +0000 |
---|---|---|
committer | ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15> | 2011-07-11 15:55:25 +0000 |
commit | 5a8925cc1e716655eead991ae15f501126c5ec63 (patch) | |
tree | 1b9ceb438a543a2b0f8a33259cb9cb57994988ec /pcretest.c | |
parent | d6b96936a1881cfdc8e619e030375d4668b46d38 (diff) | |
download | pcre-5a8925cc1e716655eead991ae15f501126c5ec63.tar.gz |
Add the ++ feature to pcretest.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@616 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcretest.c')
-rw-r--r-- | pcretest.c | 23 |
1 files changed, 12 insertions, 11 deletions
@@ -1442,6 +1442,7 @@ while (!done) int do_g = 0; int do_showinfo = showinfo; int do_showrest = 0; + int do_showcaprest = 0; int do_flip = 0; int erroroffset, len, delimiter, poffset; @@ -1607,7 +1608,10 @@ while (!done) case 's': options |= PCRE_DOTALL; break; case 'x': options |= PCRE_EXTENDED; break; - case '+': do_showrest = 1; break; + case '+': + if (do_showrest) do_showcaprest = 1; else do_showrest = 1; + break; + case 'A': options |= PCRE_ANCHORED; break; case 'B': do_debug = 1; break; case 'C': options |= PCRE_AUTO_CALLOUT; break; @@ -2587,9 +2591,9 @@ while (!done) (void)pchars(dbuffer + pmatch[i].rm_so, pmatch[i].rm_eo - pmatch[i].rm_so, outfile); fprintf(outfile, "\n"); - if (i == 0 && do_showrest) + if (do_showcaprest || (i == 0 && do_showrest)) { - fprintf(outfile, " 0+ "); + fprintf(outfile, "%2d+ ", (int)i); (void)pchars(dbuffer + pmatch[i].rm_eo, len - pmatch[i].rm_eo, outfile); fprintf(outfile, "\n"); @@ -2741,15 +2745,12 @@ while (!done) (void)pchars(bptr + use_offsets[i], use_offsets[i+1] - use_offsets[i], outfile); fprintf(outfile, "\n"); - if (i == 0) + if (do_showcaprest || (i == 0 && do_showrest)) { - if (do_showrest) - { - fprintf(outfile, " 0+ "); - (void)pchars(bptr + use_offsets[i+1], len - use_offsets[i+1], - outfile); - fprintf(outfile, "\n"); - } + fprintf(outfile, "%2d+ ", i/2); + (void)pchars(bptr + use_offsets[i+1], len - use_offsets[i+1], + outfile); + fprintf(outfile, "\n"); } } } |