OBS User unknown 2006-12-18 23:16:42 +00:00 committed by Git OBS Bridge
commit 67fe50d745
19 changed files with 1214 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

11
grep-2.5.1-bracket.patch Normal file
View File

@ -0,0 +1,11 @@
--- src/dfa.c
+++ src/dfa.c
@@ -587,7 +587,7 @@
work_mbc->coll_elems[work_mbc->ncoll_elems++] = elem;
}
}
- wc = WEOF;
+ wc = wc1 = WEOF;
}
else
/* We treat '[' as a normal character here. */

16
grep-2.5.1-conf.patch Normal file
View File

@ -0,0 +1,16 @@
--- configure.in
+++ configure.in
@@ -72,6 +72,7 @@
dnl I18N feature
ALL_LINGUAS="cs de el eo es et fr gl hr id it ja ko nl no pl pt_BR ru sl sv"
AM_GNU_GETTEXT
+AM_GNU_GETTEXT_VERSION(0.12)
dnl DOS file name convention
dnl sets HAVE_DOS_FILE_NAMES
@@ -141,4 +142,4 @@
AC_SEARCH_LIBS(pcre_exec, pcre, [AC_DEFINE(HAVE_LIBPCRE, 1, [Define to 1 if you have the `pcre' library (-lpcre).])])
fi
-AC_OUTPUT(Makefile lib/Makefile lib/posix/Makefile src/Makefile tests/Makefile po/Makefile.in intl/Makefile doc/Makefile m4/Makefile vms/Makefile bootstrap/Makefile, [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile; echo timestamp > stamp-h])
+AC_OUTPUT(Makefile lib/Makefile lib/posix/Makefile src/Makefile tests/Makefile po/Makefile.in intl/Makefile doc/Makefile m4/Makefile vms/Makefile bootstrap/Makefile)

11
grep-2.5.1-nb.patch Normal file
View File

@ -0,0 +1,11 @@
--- configure.in
+++ configure.in
@@ -70,7 +70,7 @@
esac
dnl I18N feature
-ALL_LINGUAS="cs de el eo es et fr gl hr id it ja ko nl no pl pt_BR ru sl sv"
+ALL_LINGUAS="cs de el eo es et fr gl hr id it ja ko nl nb pl pt_BR ru sl sv"
AM_GNU_GETTEXT
AM_GNU_GETTEXT_VERSION(0.12)

412
grep-2.5.1a-i18n-0.3.patch Normal file
View File

@ -0,0 +1,412 @@
--- grep-2.5.1a/lib/regex.c
+++ grep-2.5.1a/lib/regex.c
@@ -60,6 +60,10 @@
#ifdef MBS_SUPPORT
# define CHAR_TYPE wchar_t
# define US_CHAR_TYPE wchar_t/* unsigned character type */
+# define CHAR_T_SIGN (1 << (sizeof(CHAR_TYPE) * 8 - 1))
+# if defined _AIX
+# define WCHAR_T_NEED_SIGNEXTEND 1
+# endif /* _AIX */
# define COMPILED_BUFFER_VAR wc_buffer
# define OFFSET_ADDRESS_SIZE 1 /* the size which STORE_NUMBER macro use */
# define CHAR_CLASS_SIZE ((__alignof__(wctype_t)+sizeof(wctype_t))/sizeof(CHAR_TYPE)+1)
@@ -618,10 +622,13 @@
/* ifdef MBS_SUPPORT, we store NUMBER in 1 element. */
#ifdef MBS_SUPPORT
-# define EXTRACT_NUMBER(destination, source) \
- do { \
- (destination) = *(source); \
- } while (0)
+# ifdef WCHAR_T_NEED_SIGNEXTEND
+# define EXTRACT_NUMBER(destination, source) \
+ (destination) = (*(source) ^ CHAR_T_SIGN) - CHAR_T_SIGN;
+# else
+# define EXTRACT_NUMBER(destination, source) \
+ (destination) = *(source)
+# endif /* WCHAR_T_NEED_SIGNEXTEND */
#else
# define EXTRACT_NUMBER(destination, source) \
do { \
@@ -638,7 +645,11 @@
US_CHAR_TYPE *source;
{
#ifdef MBS_SUPPORT
+# ifdef WCHAR_T_NEED_SIGNEXTEND
+ *dest = (*source ^ CHAR_T_SIGN) - CHAR_T_SIGN;
+# else
*dest = *source;
+# endif /* WCHAR_T_NEED_SIGNEXTEND */
#else
int temp = SIGN_EXTEND_CHAR (*(source + 1));
*dest = *source & 0377;
--- grep-2.5.1a/src/dfa.c
+++ grep-2.5.1a/src/dfa.c
@@ -414,7 +414,7 @@
/* This function fetch a wide character, and update cur_mb_len,
used only if the current locale is a multibyte environment. */
-static wchar_t
+static wint_t
fetch_wc (char const *eoferr)
{
wchar_t wc;
@@ -423,7 +423,7 @@
if (eoferr != 0)
dfaerror (eoferr);
else
- return -1;
+ return WEOF;
}
cur_mb_len = mbrtowc(&wc, lexptr, lexleft, &mbs);
@@ -459,7 +459,7 @@
static void
parse_bracket_exp_mb ()
{
- wchar_t wc, wc1, wc2;
+ wint_t wc, wc1, wc2;
/* Work area to build a mb_char_classes. */
struct mb_char_classes *work_mbc;
@@ -497,7 +497,7 @@
work_mbc->invert = 0;
do
{
- wc1 = -1; /* mark wc1 is not initialized". */
+ wc1 = WEOF; /* mark wc1 is not initialized". */
/* Note that if we're looking at some other [:...:] construct,
we just treat it as a bunch of ordinary characters. We can do
@@ -587,7 +587,7 @@
work_mbc->coll_elems[work_mbc->ncoll_elems++] = elem;
}
}
- wc = -1;
+ wc = WEOF;
}
else
/* We treat '[' as a normal character here. */
@@ -601,7 +601,7 @@
wc = fetch_wc(("Unbalanced ["));
}
- if (wc1 == -1)
+ if (wc1 == WEOF)
wc1 = fetch_wc(_("Unbalanced ["));
if (wc1 == L'-')
@@ -631,17 +631,17 @@
}
REALLOC_IF_NECESSARY(work_mbc->range_sts, wchar_t,
range_sts_al, work_mbc->nranges + 1);
- work_mbc->range_sts[work_mbc->nranges] = wc;
+ work_mbc->range_sts[work_mbc->nranges] = (wchar_t)wc;
REALLOC_IF_NECESSARY(work_mbc->range_ends, wchar_t,
range_ends_al, work_mbc->nranges + 1);
- work_mbc->range_ends[work_mbc->nranges++] = wc2;
+ work_mbc->range_ends[work_mbc->nranges++] = (wchar_t)wc2;
}
- else if (wc != -1)
+ else if (wc != WEOF)
/* build normal characters. */
{
REALLOC_IF_NECESSARY(work_mbc->chars, wchar_t, chars_al,
work_mbc->nchars + 1);
- work_mbc->chars[work_mbc->nchars++] = wc;
+ work_mbc->chars[work_mbc->nchars++] = (wchar_t)wc;
}
}
while ((wc = wc1) != L']');
--- grep-2.5.1a/src/grep.c
+++ grep-2.5.1a/src/grep.c
@@ -30,6 +30,12 @@
# include <sys/time.h>
# include <sys/resource.h>
#endif
+#if defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H && defined HAVE_MBRTOWC
+/* We can handle multibyte string. */
+# define MBS_SUPPORT
+# include <wchar.h>
+# include <wctype.h>
+#endif
#include <stdio.h>
#include "system.h"
#include "getopt.h"
@@ -1697,6 +1703,37 @@
if (!install_matcher (matcher) && !install_matcher ("default"))
abort ();
+#ifdef MBS_SUPPORT
+ if (MB_CUR_MAX != 1 && match_icase)
+ {
+ wchar_t wc;
+ mbstate_t cur_state, prev_state;
+ int i, len = strlen (keys);
+
+ memset (&cur_state, 0, sizeof (mbstate_t));
+ for (i = 0; i <= len ;)
+ {
+ size_t mbclen;
+ mbclen = mbrtowc (&wc, keys + i, len - i, &cur_state);
+ if (mbclen == (size_t) -1 || mbclen == (size_t) -2 || mbclen == 0)
+ {
+ /* An invalid sequence, or a truncated multibyte character.
+ We treat it as a singlebyte character. */
+ mbclen = 1;
+ }
+ else
+ {
+ if (iswupper ((wint_t) wc))
+ {
+ wc = towlower ((wint_t) wc);
+ wcrtomb (keys + i, wc, &cur_state);
+ }
+ }
+ i += mbclen;
+ }
+ }
+#endif /* MBS_SUPPORT */
+
(*compile)(keys, keycc);
if ((argc - optind > 1 && !no_filenames) || with_filenames)
--- grep-2.5.1a/src/search.c
+++ grep-2.5.1a/src/search.c
@@ -149,15 +149,16 @@
static char*
check_multibyte_string(char const *buf, size_t size)
{
- char *mb_properties = malloc(size);
+ char *mb_properties = xmalloc(size);
mbstate_t cur_state;
+ wchar_t wc;
int i;
memset(&cur_state, 0, sizeof(mbstate_t));
memset(mb_properties, 0, sizeof(char)*size);
for (i = 0; i < size ;)
{
size_t mbclen;
- mbclen = mbrlen(buf + i, size - i, &cur_state);
+ mbclen = mbrtowc (&wc, buf + i, size - i, &cur_state);
if (mbclen == (size_t) -1 || mbclen == (size_t) -2 || mbclen == 0)
{
@@ -165,6 +166,14 @@
We treat it as a singlebyte character. */
mbclen = 1;
}
+ else if (match_icase)
+ {
+ if (iswupper ((wint_t) wc))
+ {
+ wc = towlower ((wint_t) wc);
+ wcrtomb (buf + i, wc, &cur_state);
+ }
+ }
mb_properties[i] = mbclen;
i += mbclen;
}
@@ -233,7 +242,7 @@
static char const line_end[] = "\\)$";
static char const word_beg[] = "\\(^\\|[^[:alnum:]_]\\)\\(";
static char const word_end[] = "\\)\\([^[:alnum:]_]\\|$\\)";
- char *n = malloc (sizeof word_beg - 1 + size + sizeof word_end);
+ char *n = xmalloc (sizeof word_beg - 1 + size + sizeof word_end);
size_t i;
strcpy (n, match_lines ? line_beg : word_beg);
i = strlen (n);
@@ -316,7 +325,7 @@
static char const line_end[] = ")$";
static char const word_beg[] = "(^|[^[:alnum:]_])(";
static char const word_end[] = ")([^[:alnum:]_]|$)";
- char *n = malloc (sizeof word_beg - 1 + size + sizeof word_end);
+ char *n = xmalloc (sizeof word_beg - 1 + size + sizeof word_end);
size_t i;
strcpy (n, match_lines ? line_beg : word_beg);
i = strlen(n);
@@ -339,14 +348,20 @@
char eol = eolbyte;
int backref, start, len;
struct kwsmatch kwsm;
- size_t i;
+ size_t i, ret_val;
#ifdef MBS_SUPPORT
char *mb_properties = NULL;
-#endif /* MBS_SUPPORT */
-
-#ifdef MBS_SUPPORT
- if (MB_CUR_MAX > 1 && kwset)
- mb_properties = check_multibyte_string(buf, size);
+ if (MB_CUR_MAX > 1)
+ {
+ if (match_icase)
+ {
+ char *case_buf = xmalloc (size);
+ memcpy (case_buf, buf, size);
+ buf = case_buf;
+ }
+ if (kwset)
+ mb_properties = check_multibyte_string (buf, size);
+ }
#endif /* MBS_SUPPORT */
buflim = buf + size;
@@ -363,8 +378,12 @@
{
#ifdef MBS_SUPPORT
if (MB_CUR_MAX > 1)
- free(mb_properties);
-#endif
+ {
+ if (match_icase)
+ free ((char *) buf);
+ free (mb_properties);
+ }
+#endif /* MBS_SUPPORT */
return (size_t)-1;
}
beg += offset;
@@ -462,18 +481,29 @@
} /* for Regex patterns. */
} /* for (beg = end ..) */
#ifdef MBS_SUPPORT
- if (MB_CUR_MAX > 1 && mb_properties)
- free (mb_properties);
+ if (MB_CUR_MAX > 1)
+ {
+ if (match_icase)
+ free ((char *) buf);
+ if (mb_properties)
+ free (mb_properties);
+ }
#endif /* MBS_SUPPORT */
return (size_t) -1;
success:
+ ret_val = beg - buf;
+ *match_size = end - beg;
#ifdef MBS_SUPPORT
- if (MB_CUR_MAX > 1 && mb_properties)
- free (mb_properties);
+ if (MB_CUR_MAX > 1)
+ {
+ if (match_icase)
+ free ((char *) buf);
+ if (mb_properties)
+ free (mb_properties);
+ }
#endif /* MBS_SUPPORT */
- *match_size = end - beg;
- return beg - buf;
+ return ret_val;
}
static void
@@ -506,10 +536,19 @@
register size_t len;
char eol = eolbyte;
struct kwsmatch kwsmatch;
+ size_t ret_val;
#ifdef MBS_SUPPORT
- char *mb_properties;
+ char *mb_properties = NULL;
if (MB_CUR_MAX > 1)
- mb_properties = check_multibyte_string (buf, size);
+ {
+ if (match_icase)
+ {
+ char *case_buf = xmalloc (size);
+ memcpy (case_buf, buf, size);
+ buf = case_buf;
+ }
+ mb_properties = check_multibyte_string (buf, size);
+ }
#endif /* MBS_SUPPORT */
for (beg = buf; beg <= buf + size; ++beg)
@@ -518,8 +557,12 @@
if (offset == (size_t) -1)
{
#ifdef MBS_SUPPORT
- if (MB_CUR_MAX > 1)
- free(mb_properties);
+ if (MB_CUR_MAX > 1)
+ {
+ if (match_icase)
+ free ((char *) buf);
+ free (mb_properties);
+ }
#endif /* MBS_SUPPORT */
return offset;
}
@@ -532,11 +575,16 @@
if (exact)
{
*match_size = len;
+ ret_val = beg - buf;
#ifdef MBS_SUPPORT
- if (MB_CUR_MAX > 1)
- free (mb_properties);
+ if (MB_CUR_MAX > 1)
+ {
+ if (match_icase)
+ free ((char *) buf);
+ free (mb_properties);
+ }
#endif /* MBS_SUPPORT */
- return beg - buf;
+ return ret_val;
}
if (match_lines)
{
@@ -557,8 +605,12 @@
if (offset == (size_t) -1)
{
#ifdef MBS_SUPPORT
- if (MB_CUR_MAX > 1)
- free (mb_properties);
+ if (MB_CUR_MAX > 1)
+ {
+ if (match_icase)
+ free ((char *) buf);
+ free (mb_properties);
+ }
#endif /* MBS_SUPPORT */
return offset;
}
@@ -574,7 +626,12 @@
#ifdef MBS_SUPPORT
if (MB_CUR_MAX > 1)
- free (mb_properties);
+ {
+ if (match_icase)
+ free ((char *) buf);
+ if (mb_properties)
+ free (mb_properties);
+ }
#endif /* MBS_SUPPORT */
return -1;
@@ -584,11 +641,17 @@
while (buf < beg && beg[-1] != eol)
--beg;
*match_size = end - beg;
+ ret_val = beg - buf;
#ifdef MBS_SUPPORT
if (MB_CUR_MAX > 1)
- free (mb_properties);
+ {
+ if (match_icase)
+ free ((char *) buf);
+ if (mb_properties)
+ free (mb_properties);
+ }
#endif /* MBS_SUPPORT */
- return beg - buf;
+ return ret_val;
}
#if HAVE_LIBPCRE

18
grep-2.5.1a-mbcset.diff Normal file
View File

@ -0,0 +1,18 @@
--- src/dfa.c
+++ src/dfa.c
@@ -1287,7 +1287,14 @@
int i;
for (i = 0; i < ntokens; ++i)
- addtok(dfa->tokens[tindex + i]);
+ {
+ addtok(dfa->tokens[tindex + i]);
+#ifdef MBS_SUPPORT
+ /* Update index into multibyte csets. */
+ if (MB_CUR_MAX > 1 && dfa->tokens[tindex + i] == MBCSET)
+ dfa->multibyte_prop[dfa->tindex - 1] = dfa->multibyte_prop[tindex + i];
+#endif
+ }
}
static void

73
grep-2.5.1a.diff Normal file
View File

@ -0,0 +1,73 @@
--- Makefile.am
+++ Makefile.am
@@ -5,21 +5,7 @@
EXTRA_DIST = TODO README README-alpha PATCHES.AC PATCHES.AM
-# We should be able to just define `ACLOCAL_AMFLAGS = --acdir=m4',
-# but this runs afoul of a bug in automake 1.
-# The following hack works around this bug by creating acinclude.m4 manually.
-ACLOCAL_AMFLAGS =
-M4DIR = $(srcdir)/m4
-ACINCLUDE_INPUTS = $(M4DIR)/decl.m4 $(M4DIR)/djgpp.m4 $(M4DIR)/dosfile.m4 \
- $(M4DIR)/envsep.m4 $(M4DIR)/error.m4 $(M4DIR)/gettext.m4 $(M4DIR)/glibc.m4 \
- $(M4DIR)/header.m4 $(M4DIR)/init.m4 $(M4DIR)/install.m4 \
- $(M4DIR)/inttypes_h.m4 $(M4DIR)/isc-posix.m4 $(M4DIR)/largefile.m4 \
- $(M4DIR)/lcmessage.m4 $(M4DIR)/malloc.m4 $(M4DIR)/mbstate_t.m4 \
- $(M4DIR)/missing.m4 $(M4DIR)/progtest.m4 $(M4DIR)/realloc.m4 \
- $(M4DIR)/regex.m4 $(M4DIR)/sanity.m4 $(M4DIR)/strerror_r.m4 \
- $(M4DIR)/uintmax_t.m4 $(M4DIR)/ulonglong.m4 $(M4DIR)/xstrtoumax.m4
-$(srcdir)/acinclude.m4 : $(ACINCLUDE_INPUTS)
- cat $(ACINCLUDE_INPUTS) >$(srcdir)/acinclude.m4
+ACLOCAL_AMFLAGS = -I m4
# make cvs-clean blatantly stolen from KDE CVS ;)
cvs-clean:
--- m4/strerror_r.m4
+++ m4/strerror_r.m4
@@ -4,8 +4,6 @@
# `run'-test that works on BeOS and segfaults on DEC Unix.
# Use with the error.c file in ../lib.
-undefine([AC_FUNC_STRERROR_R])
-
# AC_FUNC_STRERROR_R
# ------------------
AC_DEFUN([AC_FUNC_STRERROR_R],
--- src/Makefile.am
+++ src/Makefile.am
@@ -20,11 +20,11 @@
egrep:
echo '#!/bin/sh' >$@
- echo 'exec grep -E $${1+"$$@"}' >>$@
+ echo 'exec $(bindir)/'`echo grep|sed '$(transform)'`' -E $${1+"$$@"}' >>$@
chmod a+x $@
fgrep:
echo '#!/bin/sh' >$@
- echo 'exec grep -F $${1+"$$@"}' >>$@
+ echo 'exec $(bindir)/'`echo grep|sed '$(transform)'`' -F $${1+"$$@"}' >>$@
chmod a+x $@
--- src/dfa.c
+++ src/dfa.c
@@ -482,7 +482,8 @@
work_mbc->nchars = work_mbc->nranges = work_mbc->nch_classes = 0;
work_mbc->nequivs = work_mbc->ncoll_elems = 0;
- work_mbc->chars = work_mbc->ch_classes = NULL;
+ work_mbc->chars = NULL;
+ work_mbc->ch_classes = NULL;
work_mbc->range_sts = work_mbc->range_ends = NULL;
work_mbc->equivs = work_mbc->coll_elems = NULL;
@@ -551,7 +552,7 @@
wt = wctype (str);
if (ch_classes_al == 0)
- MALLOC(work_mbc->ch_classes, wchar_t, ++ch_classes_al);
+ MALLOC(work_mbc->ch_classes, wctype_t, ++ch_classes_al);
REALLOC_IF_NECESSARY(work_mbc->ch_classes, wctype_t,
ch_classes_al,
work_mbc->nch_classes + 1);

3
grep-2.5.1a.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:38c8a2bb9223d1fb1b10bdd607cf44830afc92fd451ac4cd07619bf92bdd3132
size 527386

153
grep-i18n-speedup.diff Normal file
View File

@ -0,0 +1,153 @@
--- src/grep.c
+++ src/grep.c
@@ -157,6 +157,9 @@
int match_words;
int match_lines;
unsigned char eolbyte;
+#ifdef MBS_SUPPORT
+int convert_mbstr = 0;
+#endif
/* For error messages. */
/* The name the program was run with, stripped of any leading path. */
@@ -1723,10 +1726,22 @@
}
else
{
+ wchar_t wc2;
if (iswupper ((wint_t) wc))
{
- wc = towlower ((wint_t) wc);
- wcrtomb (keys + i, wc, &cur_state);
+ wc2 = towlower ((wint_t) wc);
+ wcrtomb (keys + i, wc2, &cur_state);
+ if (mbclen > 1 && wc != wc2)
+ convert_mbstr = 1;
+ }
+ else
+ {
+ if (mbclen > 1)
+ {
+ wc2 = towupper ((wint_t) wc);
+ if (wc != wc2)
+ convert_mbstr = 1;
+ }
}
}
i += mbclen;
--- src/search.c
+++ src/search.c
@@ -72,6 +72,7 @@
#if defined(MBS_SUPPORT)
static char* check_multibyte_string PARAMS ((char const *buf, size_t size));
+extern int convert_mbstr;
#endif
static void kwsinit PARAMS ((void));
static void kwsmusts PARAMS ((void));
@@ -180,6 +181,26 @@
return mb_properties;
}
+
+/* Check whether the byte at position POS in BUF is a valid character. */
+static int
+check_valid_multibyte (const char *buf, size_t pos, size_t size)
+{
+ size_t i;
+ mbstate_t cur_state;
+
+ memset (&cur_state, 0, sizeof (mbstate_t));
+ for (i = 0; i < pos; )
+ {
+ size_t mbclen;
+ mbclen = mbrlen (buf + i, size - i, &cur_state);
+ if (mbclen == (size_t) -1 || mbclen == (size_t) -2 || mbclen == 0)
+ mbclen = 1;
+ i += mbclen;
+ }
+
+ return i == pos;
+}
#endif
static void
@@ -344,7 +365,7 @@
static size_t
EGexecute (char const *buf, size_t size, size_t *match_size, int exact)
{
- register char const *buflim, *beg, *end;
+ register char const *buflim, *beg, *end, *oldbeg;
char eol = eolbyte;
int backref, start, len;
struct kwsmatch kwsm;
@@ -358,9 +379,9 @@
char *case_buf = xmalloc (size);
memcpy (case_buf, buf, size);
buf = case_buf;
- }
- if (kwset)
- mb_properties = check_multibyte_string (buf, size);
+ if (kwset && convert_mbstr)
+ mb_properties = check_multibyte_string (buf, size);
+ }
}
#endif /* MBS_SUPPORT */
@@ -386,14 +407,24 @@
#endif /* MBS_SUPPORT */
return (size_t)-1;
}
+ oldbeg = beg;
beg += offset;
/* Narrow down to the line containing the candidate, and
run it through DFA. */
end = memchr(beg, eol, buflim - beg);
end++;
#ifdef MBS_SUPPORT
- if (MB_CUR_MAX > 1 && mb_properties[beg - buf] == 0)
- continue;
+ if (MB_CUR_MAX > 1)
+ {
+ if (mb_properties)
+ {
+ if (mb_properties[beg - buf] == 0)
+ continue;
+ }
+ else if (! check_valid_multibyte (oldbeg, offset,
+ end - oldbeg))
+ continue;
+ }
#endif
while (beg > buf && beg[-1] != eol)
--beg;
@@ -546,8 +577,9 @@
char *case_buf = xmalloc (size);
memcpy (case_buf, buf, size);
buf = case_buf;
+ if (convert_mbstr)
+ mb_properties = check_multibyte_string (buf, size);
}
- mb_properties = check_multibyte_string (buf, size);
}
#endif /* MBS_SUPPORT */
@@ -567,8 +599,16 @@
return offset;
}
#ifdef MBS_SUPPORT
- if (MB_CUR_MAX > 1 && mb_properties[offset+beg-buf] == 0)
- continue; /* It is a part of multibyte character. */
+ if (MB_CUR_MAX > 1)
+ {
+ if (mb_properties)
+ {
+ if (mb_properties[offset+beg-buf] == 0)
+ continue; /* It is a part of multibyte character. */
+ }
+ else if (! check_valid_multibyte (beg, offset, size - offset))
+ continue;
+ }
#endif /* MBS_SUPPORT */
beg += offset;
len = kwsmatch.size[0];

12
grep-manpage-err.diff Normal file
View File

@ -0,0 +1,12 @@
Index: doc/grep.1
===================================================================
--- doc/grep.1.orig
+++ doc/grep.1
@@ -191,6 +191,7 @@ Interpret
.I PATTERN
as a list of fixed strings, separated by newlines,
any of which is to be matched.
+.TP
.BR \-P ", " \-\^\-perl-regexp
Interpret
.I PATTERN

170
grep.changes Normal file
View File

@ -0,0 +1,170 @@
-------------------------------------------------------------------
Mon Jul 17 18:56:15 CEST 2006 - schwab@suse.de
- Fix matching in unsafe encodings [#192390].
-------------------------------------------------------------------
Sun Jun 11 11:01:12 CEST 2006 - schwab@suse.de
- Fix crash with -P '\xa'.
-------------------------------------------------------------------
Wed Mar 15 19:24:42 CET 2006 - schwab@suse.de
- Don't block on opening a pipe when devices are supposed to be skipped
[#149660].
-------------------------------------------------------------------
Wed Feb 8 12:30:23 CET 2006 - schwab@suse.de
- Fix dfa generation of interval expressions [#148453].
-------------------------------------------------------------------
Wed Jan 25 21:30:21 CET 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
-------------------------------------------------------------------
Fri Jan 20 15:37:08 CET 2006 - agruen@suse.de
- Fix a formatting error in the man page.
-------------------------------------------------------------------
Sat Mar 12 17:15:34 CET 2005 - schwab@suse.de
- Fix word matching.
-------------------------------------------------------------------
Mon Nov 22 13:24:31 CET 2004 - schwab@suse.de
- Update to grep 2.5.1a.
-------------------------------------------------------------------
Wed Oct 20 01:50:25 CEST 2004 - ro@suse.de
- locale rename: no -> nb
-------------------------------------------------------------------
Thu Sep 23 14:41:42 CEST 2004 - schwab@suse.de
- Better fix for last change [#45689].
-------------------------------------------------------------------
Wed Mar 17 14:01:59 CET 2004 - schwab@suse.de
- Fix dangling pointer [#36172].
-------------------------------------------------------------------
Wed Mar 3 18:00:00 CET 2004 - schwab@suse.de
- Update from CVS.
-------------------------------------------------------------------
Thu Feb 19 10:29:01 CET 2004 - kukuk@suse.de
- Cleanup neededforbuild
-------------------------------------------------------------------
Tue Feb 10 13:32:30 CET 2004 - schwab@suse.de
- Fix configure test for strerror [#34231].
-------------------------------------------------------------------
Sat Jan 10 15:44:38 CET 2004 - adrian@suse.de
- add %defattr
- let rpm strip
-------------------------------------------------------------------
Fri Jul 25 16:29:00 CEST 2003 - schwab@suse.de
- Fix parsing of bracket expressions.
-------------------------------------------------------------------
Mon Jul 21 17:02:26 CEST 2003 - schwab@suse.de
- Fix use of pointer after free.
-------------------------------------------------------------------
Fri Jun 20 02:29:15 CEST 2003 - ro@suse.de
- build with current gettext
-------------------------------------------------------------------
Wed Apr 30 18:35:32 CEST 2003 - schwab@suse.de
- Add i18n speedup patch from Takashi.
-------------------------------------------------------------------
Thu Apr 24 12:20:23 CEST 2003 - ro@suse.de
- fix install_info --delete call and move from preun to postun
-------------------------------------------------------------------
Mon Apr 7 13:11:46 CEST 2003 - schwab@suse.de
- Only delete info entries when removing last version.
-------------------------------------------------------------------
Wed Feb 12 12:42:59 CET 2003 - schwab@suse.de
- Disable huge backref test for now.
-------------------------------------------------------------------
Thu Feb 6 17:48:52 CET 2003 - schwab@suse.de
- Use %install_info.
-------------------------------------------------------------------
Mon Nov 18 13:12:35 CET 2002 - schwab@suse.de
- Add AM_GNU_GETTEXT_VERSION.
-------------------------------------------------------------------
Thu Aug 15 11:11:40 CEST 2002 - schwab@suse.de
- Add i18n patches.
-------------------------------------------------------------------
Wed Apr 3 18:26:51 CEST 2002 - schwab@suse.de
- Link -lpcre statically.
-------------------------------------------------------------------
Wed Apr 3 16:46:19 CEST 2002 - schwab@suse.de
- Update to grep 2.5.1.
* Includes support for Perl regexps.
-------------------------------------------------------------------
Wed Apr 3 16:21:16 CEST 2002 - ro@suse.de
- build with current autoconf/automake
-------------------------------------------------------------------
Tue Feb 5 10:57:56 CET 2002 - schwab@suse.de
- Don't replace autoconf macros from gettext.
-------------------------------------------------------------------
Mon Jan 28 17:52:49 CET 2002 - schwab@suse.de
- Add i18n patch.
-------------------------------------------------------------------
Tue Sep 4 14:56:42 CEST 2001 - schwab@suse.de
- Update to grep 2.4.2:
- New option --binary-files
- Final newline silently provided.
-------------------------------------------------------------------
Thu Mar 22 18:51:02 CET 2001 - ro@suse.de
- added split-aliases as provides
-------------------------------------------------------------------
Wed Mar 7 17:58:30 CET 2001 - schwab@suse.de
- Split from base.

182
grep.spec Normal file
View File

@ -0,0 +1,182 @@
#
# spec file for package grep (Version 2.5.1a)
#
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
Name: grep
BuildRequires: pcre-devel
URL: http://www.gnu.org/software/grep/
License: GPL
Group: Productivity/Text/Utilities
Provides: base:/usr/bin/grep
Autoreqprov: on
PreReq: %{install_info_prereq}
Version: 2.5.1a
Release: 21
Summary: Print lines matching a pattern
Source: grep-%{version}.tar.bz2
Patch: grep-%{version}.diff
Patch1: pcre-static.patch
Patch2: grep-2.5.1a-i18n-0.3.patch
Patch3: grep-2.5.1-conf.patch
Patch4: grep-i18n-speedup.diff
Patch5: grep-2.5.1-bracket.patch
Patch6: grep-2.5.1-nb.patch
Patch7: wordmatch.patch
Patch8: grep-manpage-err.diff
Patch9: grep-2.5.1a-mbcset.diff
Patch10: skip-devices.diff
Patch11: pcre-execute.diff
Patch12: kwset.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
GNU grep, the "fastest grep in the west" (hopefully).
`grep' searches for lines matching a pattern.
Authors:
--------
Alain Magloire <alainm@rcsm.ece.mcgill.ca>
Aharon Robbins <arnold@gnu.org>
David J MacKenzie <djm@catapult.va.pubnix.com>
Karl Berry <karl@cs.umb.edu>
Ulrich Drepper <drepper@cygnus.com>
%prep
%setup
%patch
%patch1
%patch2 -p1
%patch3
%patch4
%patch5
%patch6
%patch7
%patch8
%patch9
%patch10
%patch11
%patch12
rename no nb po/no.*
%build
%{suse_update_config -f}
rm -f m4/header.m4 m4/init.m4 m4/install.m4 m4/largefile.m4 m4/missing.m4 m4/sanity.m4
autoreconf --force --install
test -f po/Makevars || mv po/Makevars.template po/Makevars
./configure CFLAGS="$RPM_OPT_FLAGS" \
--prefix=/usr --mandir=%{_mandir} --infodir=%{_infodir} \
--bindir=/bin --build=%{_target_cpu}-suse-linux
make
make check
%install
make install DESTDIR=$RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT/usr/bin
ln -sf ../../bin/egrep $RPM_BUILD_ROOT/usr/bin/egrep
ln -sf ../../bin/fgrep $RPM_BUILD_ROOT/usr/bin/fgrep
ln -sf ../../bin/grep $RPM_BUILD_ROOT/usr/bin/grep
%post
%install_info --info-dir=%{_infodir} %{_infodir}/grep.info.gz
%postun
%install_info_delete --info-dir=%{_infodir} %{_infodir}/grep.info.gz
%files
%defattr(-,root,root)
%doc README ABOUT-NLS AUTHORS COPYING NEWS THANKS TODO
/bin/egrep
/bin/fgrep
/bin/grep
/usr/bin/egrep
/usr/bin/fgrep
/usr/bin/grep
%doc %{_mandir}/man1/egrep.1.gz
%doc %{_mandir}/man1/fgrep.1.gz
%doc %{_mandir}/man1/grep.1.gz
%doc %{_infodir}/grep*.gz
/usr/share/locale/*/LC_MESSAGES/grep.mo
%changelog -n grep
* Mon Jul 17 2006 - schwab@suse.de
- Fix matching in unsafe encodings [#192390].
* Sun Jun 11 2006 - schwab@suse.de
- Fix crash with -P '\xa'.
* Wed Mar 15 2006 - schwab@suse.de
- Don't block on opening a pipe when devices are supposed to be skipped
[#149660].
* Wed Feb 08 2006 - schwab@suse.de
- Fix dfa generation of interval expressions [#148453].
* Wed Jan 25 2006 - mls@suse.de
- converted neededforbuild to BuildRequires
* Fri Jan 20 2006 - agruen@suse.de
- Fix a formatting error in the man page.
* Sat Mar 12 2005 - schwab@suse.de
- Fix word matching.
* Mon Nov 22 2004 - schwab@suse.de
- Update to grep 2.5.1a.
* Wed Oct 20 2004 - ro@suse.de
- locale rename: no -> nb
* Thu Sep 23 2004 - schwab@suse.de
- Better fix for last change [#45689].
* Wed Mar 17 2004 - schwab@suse.de
- Fix dangling pointer [#36172].
* Wed Mar 03 2004 - schwab@suse.de
- Update from CVS.
* Thu Feb 19 2004 - kukuk@suse.de
- Cleanup neededforbuild
* Tue Feb 10 2004 - schwab@suse.de
- Fix configure test for strerror [#34231].
* Sat Jan 10 2004 - adrian@suse.de
- add %%defattr
- let rpm strip
* Fri Jul 25 2003 - schwab@suse.de
- Fix parsing of bracket expressions.
* Mon Jul 21 2003 - schwab@suse.de
- Fix use of pointer after free.
* Fri Jun 20 2003 - ro@suse.de
- build with current gettext
* Wed Apr 30 2003 - schwab@suse.de
- Add i18n speedup patch from Takashi.
* Thu Apr 24 2003 - ro@suse.de
- fix install_info --delete call and move from preun to postun
* Mon Apr 07 2003 - schwab@suse.de
- Only delete info entries when removing last version.
* Wed Feb 12 2003 - schwab@suse.de
- Disable huge backref test for now.
* Thu Feb 06 2003 - schwab@suse.de
- Use %%install_info.
* Mon Nov 18 2002 - schwab@suse.de
- Add AM_GNU_GETTEXT_VERSION.
* Thu Aug 15 2002 - schwab@suse.de
- Add i18n patches.
* Wed Apr 03 2002 - schwab@suse.de
- Link -lpcre statically.
* Wed Apr 03 2002 - schwab@suse.de
- Update to grep 2.5.1.
* Includes support for Perl regexps.
* Wed Apr 03 2002 - ro@suse.de
- build with current autoconf/automake
* Tue Feb 05 2002 - schwab@suse.de
- Don't replace autoconf macros from gettext.
* Mon Jan 28 2002 - schwab@suse.de
- Add i18n patch.
* Tue Sep 04 2001 - schwab@suse.de
- Update to grep 2.4.2:
- New option --binary-files
- Final newline silently provided.
* Thu Mar 22 2001 - ro@suse.de
- added split-aliases as provides
* Wed Mar 07 2001 - schwab@suse.de
- Split from base.

37
kwset.diff Normal file
View File

@ -0,0 +1,37 @@
--- src/search.c
+++ src/search.c
@@ -365,7 +365,7 @@
static size_t
EGexecute (char const *buf, size_t size, size_t *match_size, int exact)
{
- register char const *buflim, *beg, *end, *oldbeg;
+ register char const *buflim, *beg, *end;
char eol = eolbyte;
int backref, start, len;
struct kwsmatch kwsm;
@@ -407,25 +407,11 @@
#endif /* MBS_SUPPORT */
return (size_t)-1;
}
- oldbeg = beg;
beg += offset;
/* Narrow down to the line containing the candidate, and
run it through DFA. */
end = memchr(beg, eol, buflim - beg);
end++;
-#ifdef MBS_SUPPORT
- if (MB_CUR_MAX > 1)
- {
- if (mb_properties)
- {
- if (mb_properties[beg - buf] == 0)
- continue;
- }
- else if (! check_valid_multibyte (oldbeg, offset,
- end - oldbeg))
- continue;
- }
-#endif
while (beg > buf && beg[-1] != eol)
--beg;
if (kwsm.index < kwset_exact_matches)

13
pcre-execute.diff Normal file
View File

@ -0,0 +1,13 @@
--- src/search.c
+++ src/search.c
@@ -805,8 +805,8 @@
char eol = eolbyte;
if (!exact)
{
- end = memchr (end, eol, buflim - end);
- end++;
+ if (!(end > buf && end[-1] == eol))
+ end = memchr (end, eol, buflim - end) + 1;
while (buf < beg && beg[-1] != eol)
--beg;
}

14
pcre-static.patch Normal file
View File

@ -0,0 +1,14 @@
--- configure.in
+++ configure.in
@@ -136,9 +136,9 @@
if test x"$testpcre" = x"yes"; then
if pcre-config --cflags >/dev/null 2>&1; then
CFLAGS="$CFLAGS `pcre-config --cflags`"
- LIBS="$LIBS `pcre-config --libs`"
+ LIBS="$LIBS -Wl,-Bstatic `pcre-config --libs` -Wl,-Bdynamic"
fi
- AC_CHECK_LIB(pcre, pcre_exec)
+ AC_SEARCH_LIBS(pcre_exec, pcre, [AC_DEFINE(HAVE_LIBPCRE, 1, [Define to 1 if you have the `pcre' library (-lpcre).])])
fi
AC_OUTPUT(Makefile lib/Makefile lib/posix/Makefile src/Makefile tests/Makefile po/Makefile.in intl/Makefile doc/Makefile m4/Makefile vms/Makefile bootstrap/Makefile, [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in > po/Makefile; echo timestamp > stamp-h])

0
ready Normal file
View File

53
skip-devices.diff Normal file
View File

@ -0,0 +1,53 @@
2004-11-20 Benno Schulenberg <benno@nietvergeten.nl> (tiny change)
* src/grep.c (reset): Move the stat check ...
(grepfile): ... here, and also check for a fifo.
Index: src/grep.c
===================================================================
RCS file: /sources/grep/grep/src/grep.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -a -p -u -p -a -r1.83 -r1.84
--- src/grep.c 20 Nov 2004 16:15:57 -0000 1.83
+++ src/grep.c 20 Nov 2004 16:20:38 -0000 1.84
@@ -255,19 +255,6 @@ reset (int fd, char const *file, struct
bufbeg[-1] = eolbyte;
bufdesc = fd;
- if (fstat (fd, &stats->stat) != 0)
- {
- error (0, errno, "fstat");
- return 0;
- }
- if (directories == SKIP_DIRECTORIES && S_ISDIR (stats->stat.st_mode))
- return 0;
-#ifndef DJGPP
- if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode) || S_ISSOCK(stats->stat.st_mode)))
-#else
- if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode)))
-#endif
- return 0;
if (S_ISREG (stats->stat.st_mode))
{
if (file)
@@ -928,6 +915,19 @@ grepfile (char const *file, struct stats
}
else
{
+ if (stat (file, &stats->stat) != 0)
+ {
+ suppressible_error (file, errno);
+ return 1;
+ }
+ if (directories == SKIP_DIRECTORIES && S_ISDIR (stats->stat.st_mode))
+ return 1;
+#ifndef DJGPP
+ if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode) || S_ISSOCK(stats->stat.st_mode) || S_ISFIFO(stats->stat.st_mode)))
+#else
+ if (devices == SKIP_DEVICES && (S_ISCHR(stats->stat.st_mode) || S_ISBLK(stats->stat.st_mode)))
+#endif
+ return 1;
while ((desc = open (file, O_RDONLY)) < 0 && errno == EINTR)
continue;

12
wordmatch.patch Normal file
View File

@ -0,0 +1,12 @@
--- src/search.c
+++ src/search.c
@@ -641,7 +641,8 @@
break;
if (try + len < buf + size && WCHAR((unsigned char) try[len]))
{
- offset = kwsexec (kwset, beg, --len, &kwsmatch);
+ ++beg;
+ offset = kwsexec (kwset, beg, buf + size - beg, &kwsmatch);
if (offset == (size_t) -1)
{
#ifdef MBS_SUPPORT