From 25dbe146bdc7841eca480a36341edf86b9b5fda5 Mon Sep 17 00:00:00 2001 From: "Philip.Hazel" Date: Thu, 29 Dec 2016 16:29:05 +0000 Subject: [PATCH] Very minor tidy to pcre2grep, plus fix typos in comments. --- ChangeLog | 3 ++ src/pcre2grep.c | 6 ++-- testdata/grepoutput | 74 ++++++++++++++++++++++----------------------- 3 files changed, 43 insertions(+), 40 deletions(-) diff --git a/ChangeLog b/ChangeLog index 48004a5..4cc3404 100644 --- a/ChangeLog +++ b/ChangeLog @@ -269,6 +269,9 @@ characters to match (for example, /[\s[:^ascii:]]/). 40. The callout_error modifier has been added to pcre2test to make it possible to return PCRE2_ERROR_CALLOUT from a callout. +41. A minor change to pcre2grep: colour reset is now "[0m" instead of +"[00m". + Version 10.22 29-July-2016 -------------------------- diff --git a/src/pcre2grep.c b/src/pcre2grep.c index 0c9b8c6..5d1654e 100644 --- a/src/pcre2grep.c +++ b/src/pcre2grep.c @@ -693,7 +693,7 @@ print_match(const char* buf, int length) { if (do_colour) fprintf(stdout, "%c[%sm", 0x1b, colour_string); FWRITE(buf, 1, length, stdout); -if (do_colour) fprintf(stdout, "%c[00m", 0x1b); +if (do_colour) fprintf(stdout, "%c[0m", 0x1b); } /* End of Unix-style or native z/OS environment functions. */ @@ -1686,7 +1686,7 @@ while (length > 0) } else if (*string == '{') { - /* Must be a decimal number in parenthesis, e.g: (5) or (38) */ + /* Must be a decimal number in braces, e.g: {5} or {38} */ string++; length--; @@ -1708,7 +1708,7 @@ while (length > 0) } while (*string >= '0' && *string <= '9'); - /* Syntax error: close paren is missing. */ + /* Syntax error: closing brace is missing. */ if (*string != '}') return 0; } diff --git a/testdata/grepoutput b/testdata/grepoutput index 4dc521b..a139b44 100644 --- a/testdata/grepoutput +++ b/testdata/grepoutput @@ -456,8 +456,8 @@ over the lazy dog. This time it jumps and jumps and jumps. RC=0 ---------------------------- Test 52 ------------------------------ -fox jumps -This time it jumps and jumps and jumps. +fox jumps +This time it jumps and jumps and jumps. RC=0 ---------------------------- Test 53 ------------------------------ 36972,6 @@ -474,9 +474,9 @@ RC=0 597:32,4 RC=0 ---------------------------- Test 55 ----------------------------- -Here is the pattern again. -That time it was on a line by itself. -This line contains pattern not on a line by itself. +Here is the pattern again. +That time it was on a line by itself. +This line contains pattern not on a line by itself. RC=0 ---------------------------- Test 56 ----------------------------- ./testdata/grepinput:456 @@ -588,52 +588,52 @@ RC=0 ---------------------------- Test 70 ----------------------------- triple: t1_txt s1_tag s_txt p_tag p_txt o_tag o_txt -triple: t3_txt s2_tag s_txt p_tag p_txt o_tag o_txt +triple: t3_txt s2_tag s_txt p_tag p_txt o_tag o_txt -triple: t4_txt s1_tag s_txt p_tag p_txt o_tag o_txt +triple: t4_txt s1_tag s_txt p_tag p_txt o_tag o_txt -triple: t6_txt s2_tag s_txt p_tag p_txt o_tag o_txt +triple: t6_txt s2_tag s_txt p_tag p_txt o_tag o_txt -RC=0 +RC=0 ---------------------------- Test 71 ----------------------------- 01 RC=0 ---------------------------- Test 72 ----------------------------- -010203040506 +010203040506 RC=0 ---------------------------- Test 73 ----------------------------- -01 +01 RC=0 ---------------------------- Test 74 ----------------------------- 01 02 RC=0 ---------------------------- Test 75 ----------------------------- -010203040506 +010203040506 RC=0 ---------------------------- Test 76 ----------------------------- -01 -02 +01 +02 RC=0 ---------------------------- Test 77 ----------------------------- 01 03 RC=0 ---------------------------- Test 78 ----------------------------- -010203040506 +010203040506 RC=0 ---------------------------- Test 79 ----------------------------- -01 -03 +01 +03 RC=0 ---------------------------- Test 80 ----------------------------- 01 RC=0 ---------------------------- Test 81 ----------------------------- -010203040506 +010203040506 RC=0 ---------------------------- Test 82 ----------------------------- -01 +01 RC=0 ---------------------------- Test 83 ----------------------------- pcre2grep: line 4 of file ./testdata/grepinput3 is too long for the internal buffer @@ -702,9 +702,9 @@ RC=0 ./testdata/grepinput:zerothe. RC=0 ---------------------------- Test 101 ------------------------------ -./testdata/grepinput:.|zero|the|. -./testdata/grepinput:zero|a -./testdata/grepinput:.|zero|the|. +./testdata/grepinput:.|zero|the|. +./testdata/grepinput:zero|a +./testdata/grepinput:.|zero|the|. RC=0 ---------------------------- Test 102 ----------------------------- 2: @@ -725,21 +725,21 @@ RC=0 14: RC=0 ---------------------------- Test 105 ----------------------------- -triple: t1_txt s1_tag s_txt p_tag p_txt o_tag o_txt - -triple: t2_txt s1_tag s_txt p_tag p_txt o_tag -Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. - -triple: t3_txt s2_tag s_txt p_tag p_txt o_tag o_txt - -triple: t4_txt s1_tag s_txt p_tag p_txt o_tag o_txt - -triple: t5_txt s1_tag s_txt p_tag p_txt o_tag -o_txt - -triple: t6_txt s2_tag s_txt p_tag p_txt o_tag o_txt - -triple: t7_txt s1_tag s_txt p_tag p_txt o_tag o_txt +triple: t1_txt s1_tag s_txt p_tag p_txt o_tag o_txt + +triple: t2_txt s1_tag s_txt p_tag p_txt o_tag +Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. + +triple: t3_txt s2_tag s_txt p_tag p_txt o_tag o_txt + +triple: t4_txt s1_tag s_txt p_tag p_txt o_tag o_txt + +triple: t5_txt s1_tag s_txt p_tag p_txt o_tag +o_txt + +triple: t6_txt s2_tag s_txt p_tag p_txt o_tag o_txt + +triple: t7_txt s1_tag s_txt p_tag p_txt o_tag o_txt RC=0 ---------------------------- Test 106 ----------------------------- a