summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/grep/01-fgrep.patch
diff options
context:
space:
mode:
authorJames Meyer <James.meyer@operamail.com>2008-10-02 03:19:12 (GMT)
committerJames Meyer <James.meyer@operamail.com>2008-10-02 03:19:12 (GMT)
commit0e2532d4e8f4eed5e047f1db54d5c03ba849ec0a (patch)
treec0aa2c0b53c317be87eacfcb77b63f53f1f415e7 /abs/core-testing/grep/01-fgrep.patch
downloadlinhes_pkgbuild-0e2532d4e8f4eed5e047f1db54d5c03ba849ec0a.zip
linhes_pkgbuild-0e2532d4e8f4eed5e047f1db54d5c03ba849ec0a.tar.gz
linhes_pkgbuild-0e2532d4e8f4eed5e047f1db54d5c03ba849ec0a.tar.bz2
initial import
Diffstat (limited to 'abs/core-testing/grep/01-fgrep.patch')
-rw-r--r--abs/core-testing/grep/01-fgrep.patch145
1 files changed, 145 insertions, 0 deletions
diff --git a/abs/core-testing/grep/01-fgrep.patch b/abs/core-testing/grep/01-fgrep.patch
new file mode 100644
index 0000000..c7f8f96
--- /dev/null
+++ b/abs/core-testing/grep/01-fgrep.patch
@@ -0,0 +1,145 @@
+--- grep-2.5.1/src/search.c.fgrep 2001-04-19 04:42:14.000000000 +0100
++++ grep-2.5.1/src/search.c 2004-02-26 13:09:32.000000000 +0000
+@@ -360,13 +360,7 @@
+ /* Find a possible match using the KWset matcher. */
+ size_t offset = kwsexec (kwset, beg, buflim - beg, &kwsm);
+ if (offset == (size_t) -1)
+- {
+-#ifdef MBS_SUPPORT
+- if (MB_CUR_MAX > 1)
+- free(mb_properties);
+-#endif
+- return (size_t)-1;
+- }
++ goto failure;
+ beg += offset;
+ /* Narrow down to the line containing the candidate, and
+ run it through DFA. */
+@@ -379,7 +373,7 @@
+ while (beg > buf && beg[-1] != eol)
+ --beg;
+ if (kwsm.index < kwset_exact_matches)
+- goto success;
++ goto success_in_beg_and_end;
+ if (dfaexec (&dfa, beg, end - beg, &backref) == (size_t) -1)
+ continue;
+ }
+@@ -398,7 +392,7 @@
+ }
+ /* Successful, no backreferences encountered! */
+ if (!backref)
+- goto success;
++ goto success_in_beg_and_end;
+ }
+ else
+ end = beg + size;
+@@ -413,14 +407,11 @@
+ end - beg - 1, &(patterns[i].regs))))
+ {
+ len = patterns[i].regs.end[0] - start;
+- if (exact)
+- {
+- *match_size = len;
+- return start;
+- }
++ if (exact && !match_words)
++ goto success_in_start_and_len;
+ if ((!match_lines && !match_words)
+ || (match_lines && len == end - beg - 1))
+- goto success;
++ goto success_in_beg_and_end;
+ /* If -w, check if the match aligns with word boundaries.
+ We do this iteratively because:
+ (a) the line may contain more than one occurence of the
+@@ -434,7 +425,7 @@
+ if ((start == 0 || !WCHAR ((unsigned char) beg[start - 1]))
+ && (len == end - beg - 1
+ || !WCHAR ((unsigned char) beg[start + len])))
+- goto success;
++ goto success_in_beg_and_end;
+ if (len > 0)
+ {
+ /* Try a shorter length anchored at the same place. */
+@@ -461,19 +452,26 @@
+ }
+ } /* for Regex patterns. */
+ } /* for (beg = end ..) */
++
++ failure:
+ #ifdef MBS_SUPPORT
+ if (MB_CUR_MAX > 1 && mb_properties)
+ free (mb_properties);
+ #endif /* MBS_SUPPORT */
+ return (size_t) -1;
+
+- success:
++ success_in_beg_and_end:
++ len = end - beg;
++ start = beg - buf;
++ /* FALLTHROUGH */
++
++ success_in_start_and_len:
+ #ifdef MBS_SUPPORT
+ if (MB_CUR_MAX > 1 && mb_properties)
+ free (mb_properties);
+ #endif /* MBS_SUPPORT */
+- *match_size = end - beg;
+- return beg - buf;
++ *match_size = len;
++ return start;
+ }
+
+ static void
+@@ -516,28 +514,15 @@
+ {
+ size_t offset = kwsexec (kwset, beg, buf + size - beg, &kwsmatch);
+ if (offset == (size_t) -1)
+- {
+-#ifdef MBS_SUPPORT
+- if (MB_CUR_MAX > 1)
+- free(mb_properties);
+-#endif /* MBS_SUPPORT */
+- return offset;
+- }
++ goto failure;
+ #ifdef MBS_SUPPORT
+ if (MB_CUR_MAX > 1 && mb_properties[offset+beg-buf] == 0)
+ continue; /* It is a part of multibyte character. */
+ #endif /* MBS_SUPPORT */
+ beg += offset;
+ len = kwsmatch.size[0];
+- if (exact)
+- {
+- *match_size = len;
+-#ifdef MBS_SUPPORT
+- if (MB_CUR_MAX > 1)
+- free (mb_properties);
+-#endif /* MBS_SUPPORT */
+- return beg - buf;
+- }
++ if (exact && !match_words)
++ goto success_in_beg_and_len;
+ if (match_lines)
+ {
+ if (beg > buf && beg[-1] != eol)
+@@ -551,6 +536,7 @@
+ goto success;
+ }
+
++ failure:
+ #ifdef MBS_SUPPORT
+ if (MB_CUR_MAX > 1)
+ free (mb_properties);
+@@ -583,7 +569,11 @@
+ end++;
+ while (buf < beg && beg[-1] != eol)
+ --beg;
+- *match_size = end - beg;
++ len = end - beg;
++ /* FALLTHROUGH */
++
++ success_in_beg_and_len:
++ *match_size = len;
+ #ifdef MBS_SUPPORT
+ if (MB_CUR_MAX > 1)
+ free (mb_properties);