summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Fixesv2.5.2Bernhard Rosenkraenzer2006-11-244-30/+26
| | | | * po/Makefile.in.in: Adjust to work with automake 1.1x
* Adjust to current configure.* scripts, part 2Bernhard Rosenkraenzer2006-11-241-1/+1
|
* Fix Makefile.cvsBernhard Rosenkraenzer2006-11-242-2/+7
| | | | * Makefile.cvs: Update to work with current autoconf scripts
* Update version numberBernhard Rosenkraenzer2006-11-243-104/+12
| | | | * configure.ac.in, grep.spec: Update version number
* Update NEWS fileBernhard Rosenkraenzer2006-11-241-0/+1
|
* --exclude-dirBernhard Rosenkraenzer2006-08-187-13/+54
| | | | | * lib/savedir.c, lib/savedir.h, src/grep.c, doc/*: Add --exclude-dir option (patch #5051)
* Document changesBernhard Rosenkraenzer2006-08-181-0/+13
| | | | | | | | | * po/*: Sync with translation project * doc/*: Assorted documentation updates, Patch #4610 * autogen.sh, configure.in, configure.ac.in: Autogenerate ALL_LINGUAS variable * m4/strerror_r.m4, configure.ac.in: Fix detection of strerror_r * lib/error.c: Remove bogus warning
* Remove bogus warningBernhard Rosenkraenzer2006-08-181-6/+0
|
* Fix strerror_r detection, based onBernhard Rosenkraenzer2006-08-182-70/+1
| | | | http://lists.gnu.org/archive/html/bug-grep/2006-06/msg00023.html
* Changes from comment attached to patch 4610Bernhard Rosenkraenzer2006-08-181-11/+11
|
* Apply documentation patch (#4610)Bernhard Rosenkraenzer2006-08-182-909/+1656
|
* Autogenerate ALL_LINGUAS so we don't have to update it manually every timeBernhard Rosenkraenzer2006-08-182-2/+13
|
* Add current translations from www.iro.umontreal.caBernhard Rosenkraenzer2006-08-1839-1781/+7887
|
* * tests/foad1.sh: Use ": ${VERBOSE=}" so that the caller canCharles Levert2005-11-182-5/+22
| | | | | | | | | | | | | | | | set it without modifying the script; the usual caller (Makefile) still leaves it untouched (usually unset, so it's off by default). Modify "-m1 -A99 '^...$'" tests that failed so that their expectation now corresponds to the output currently produced by grep. Those tests used to expect that two selected (or selectable) lines be output, even with -m1. Nothing was modified with other similar tests that output _context_ lines after one selected line has been output with -m1; they used to and still succeed. Although tests/yesno.sh now provides a more comprehensive framework for testing -m/-C feature interaction, it doesn't exercise mixing them with anchors so the whole relevant tests/foad1.sh test group is kept, notably to check that grep doesn't crash when it is run.
* On 2005-06-21, many changes were made that affected --color,Charles Levert2005-11-172-42/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | --only-matching, and --invert-match. Some of them introduced a misunderstanding between the concepts of matched/non-matched and selected/rejected lines. Furthermore, a few bugs with -v sneaked in stemming from this. This set of changes aims to rectify most of this situation. Some GREP_COLORS capabilities are also added as a result of the clarification. (Further issues with -v/-o/-C feature interaction still remain to be sorted out.) * src/grep.c: Rename/add global variables, macros, and capabilities: SEP_CHAR_MATCH --> SEP_CHAR_SELECTED SEP_CHAR_CONTEXT --> SEP_CHAR_REJECTED SEP_STR_CHUNK --> SEP_STR_GROUP grep_color --> selected_match_color + context_match_color mlines_color --> selected_line_color context_color --> context_line_color "ml" --> "sl" "mt" --> "mt" = "ms" + "mc" --> "rv" (reverse "sl"/"cx" when -v) * src/grep.c (color_cap_mt_fct, color_cap_rv_fct): New functions. * src/grep.c (print_line_tail): Renamed color argument to line_color. * src/grep.c (print_line_middle, prline): Revert part of the logic to a pre-2005-06-21 one so that lines with matches have their matched parts properly handled again ("m?" colors or --only-matching), whether or not -v is specified. Whole line colors ("sl", "cx") follow a selected / rejected(context) logic, as opposed to a matched / non-matched one (unless "rv"). Matched text colors ("ms", "mc") always follow a selected / rejected(context) logic, regardless of "rv", because only matched lines use them anyway. pr_line_middle() now takes additional line_color and match_color arguments computed by prline() prior to calling that function. The old logic was a buggy hybrid matched / rejected(context) one. * src/grep.c (prpending, prtext, grepfile): Renamed macro invocations. * src/grep.c (parse_grep_colors): Update top comment. * src/grep.c (main): GREP_COLOR (singular) now sets both selected_match_color and context_match_color.
* * src/search.c (Pcompile): Clarify message for the -P optionCharles Levert2005-11-162-1/+8
| | | | | | not being supported so that users don't assume it's a run-time problem, but know that it's a compile-time configuration choice. Based on an idea by: Benno Schulenberg <benno@nietvergeten.nl>.
* * tests/yesno.sh: New file. Test feature interactionCharles Levert2005-11-133-2/+127
| | | | | | | | of -C, -v, -o, and -m. This reveals bugs, including some I introduced on 2005-06-21, but also others. * tests/Makefile.am (TESTS): Add yesno.sh. * tests/Makefile.am (CLEANFILES): Add cspatfile and csinput, as created by fmbtest.sh. Add yesno.txt, as created by yesno.sh.
* * src/grep.c (parse_grep_colors, main): Replace all uses ofCharles Levert2005-11-112-16/+16
| | | | | | fprintf(stderr, _("%s: foo\n"), program_name, ...) with error(0, 0, _("foo"), ...) for uniformization and simplification of warning messages that will be up for localization. (My bad.)
* * src/search.c (Pcompile): Abort in error if -P and multiple patternsCharles Levert2005-11-112-2/+10
| | | | | | | are specified, with an error message explaining the situation. Fixing this won't be simple; the '\n' characters separating the patterns cannot just be replaced by '|' to create an alternation as back-references are assumed to be local to each individual pattern.
* * grep/configure.in (ALL_LINGUAS): Add languages that were missingCharles Levert2005-11-112-1/+7
| | | | | from this variable (bg, ca, da, nb, tr), but that GNU grep supports with a po/xx.po file. Reported by Tony Abou-Assaleh <taa@acm.org>.
* The introduction of the --only-matching and --color GNU extensionsCharles Levert2005-11-106-111/+184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to grep added the requirement that each execute() implementation not only be able to identify matching lines as a whole, but also individual "exact" matches within a line known to be matching, from leftmost to rightmost match, when the output from matching lines is actually produced. The interface and implementations of execute() were not up to it. This set of changes aims to rectify that situation. Previously failing tests relative to left anchors (^ and \<) and -w should now pass. This fixes <http://savannah.gnu.org/bugs/?func=detailitem&item_id=11579>, <http://savannah.gnu.org/patch/?func=detailitem&item_id=1834>, <http://savannah.gnu.org/bugs/?func=detailitem&item_id=8243>, and possibly part of other, bigger, pending patches. The problem was also compounded by the POSIX requirement to support a pattern list instead of just an individual pattern (for -G and -E as well). * tests/foad1.sh: Test for increasing/decreasing-length word matches, given pattern order, and leftmost/longest match. * tests/fmbtest.sh: Modify test #6 according to new expectations. Better document what tests #6 and #7 are actually for. Eliminate test #5 in favor of bringing tests #6 and #7 within the F G E loop. * src/grep.h (EXECUTE_ARGS): Change last argument from "int exact" to "char const *start_ptr". Testing for "start_ptr" being non-NULL retains the same semantics as testing for "exact" being non-zero. * src/grep.c (print_line_middle): Call execute() with whole buffer to work on, but using current position as start_ptr. * src/grep.c (prpending, grepbuf): Call execute() with NULL as start_ptr. * src/search.c (EGexecute, Fexecute, Pexecute): When start_ptr is non-NULL, return first match from it as an offset relative to buf. * src/search.c (EGexecute): Consider all patterns if many and, for an exact match, return the best one (leftmost, then longest). Don't explore worst solutions, of course (branch and bound).
* * src/grep.c (main): Fix a subtle memory allocation bug introducedCharles Levert2005-11-102-2/+10
| | | | | with the mb_icase_keys() function, which can call xrealloc() or free() on keys, by making sure keys is always dynamically allocated.
* * doc/grep.1, doc/grep.texi: Advise users to test forCharles Levert2005-11-093-1/+23
| | | | | | "exit_status > 1" instead of "exit_status == 2" in order to detect errors, for portability with other POSIX-compliant implementations.
* The following set of changes aims to make "egrep" and "fgrep"Charles Levert2005-11-0911-286/+334
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | minimal executable programs for legacy applications, instead of shell scripts. This "fgrep" is much smaller than "grep". This set of changes appears more daunting than it really is. * src/egrep.c, src/fgrep.c, src/esearch.c, src/fsearch.c: New files that #define either EGREP_PROGRAM or FGREP_PROGRAM and #include the corresponding generic (i.e., non e or f specific) *.c file. * src/grepmat.c: Remove whole file. * src/Makefile.am: Remove no-dependencies from AUTOMAKE_OPTIONS. Add definitions to make "egrep" and "fgrep" specific standalone executable programs that only use the source files they need. Remove rules for "egrep" and "fgrep" shell scripts. * src/grep.h: #define GREP_PROGRAM if both EGREP_PROGRAM and FGREP_PROGRAM are #undef. Only declare matchers[] in this case along with the compile_fp_t and execute_fp_t function pointers typedefs, otherwise declare prototypes for straight compile() and execute() functions for the specialized "egrep" and "fgrep" programs. Remove the extern declaration for matcher. Define COMPILE_RET, COMPILE_ARGS, EXECUTE_RET, EXECUTE_ARGS, COMPILE_FCT, and EXECUTE_FCT helper preprocessor macros. * src/grep.c (short_options, long_options, usage, main): Only support -G, -E, -F, -P, and -X for GREP_PROGRAM, but not for EGREP_PROGRAM or FGREP_PROGRAM. Customize usage messages. * src/grep.c (set_limits): New function with unchanged code, called from main(), because it shouldn't be in install_matcher() since it was already matcher-independent. * src/grep.c (matcher): Add as static, only for GREP_PROGRAM. * src/grep.c (setmatcher, install_matcher): Only for GREP_PROGRAM. * src/grep.c (main): Remove any tweaking and dependence on argv[0]. * src/grep.c (print_line_middle, prpending, grepbuf, main): Call compile() and execute() directly, not through a function pointer dereferencing notation, so that it works with both straight functions (in EGREP_PROGRAM and FGREP_PROGRAM) and function pointers (in GREP_PROGRAM). * src/search.c (<regex.h>, "dfa.h", dfa, pattern0, patterns, pcount, dfaerror, kwset_exact_matches, kwsmusts): Only include/declare/define if not FGREP_PROGRAM. * src/search.c: Remove function prototypes for all functions that are not used before their definition, since this is just a hassle now with their varying names and conditional definition. * src/search.c (GEAcompile): Rename from Ecompile(). Add new syntax_bits argument/variable. Use as compile() for EGREP_PROGRAM. Put in the needed RE_ICASE fix, albeit commented-out for now. Make sure to free() modified word/line pattern after use, if any. * src/search.c (Gcompile): Merge with GEAcompile() then remove. * src/search.c (Gcompile, Acompile, Ecompile): New small functions that call GEAcompile(), now that matcher is not an extern variable. * src/search.c (GEAcompile, Gcompile, Acompile, Ecompile, Fcompile, Pcompile, EGexecute, Fexecute, Pexecute, matchers): Only define when needed according to *GREP_PROGRAM, and rename to just compile() and execute() when appropriate. * grep/bootstrap/Makefile.try: Similar changes.
* * README.DOS, TODO, grep.spec, doc/grep.1, doc/grep.texi,Charles Levert2005-11-0811-54/+88
| | | | | | | | | | | | src/grep.h, po/da.po, po/nb.po, po/no.po, po/sv.po: Replace all capitalized "Grep" by a lowercase "grep", except in citations. Reported by Benno Schulenberg <benno@nietvergeten.nl> from the <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=190551> entry in the Debian bug tracker. * doc/grep.1, doc/grep.texi: Explain that the "egrep" and "fgrep" commands are deprecated and provided for historical applications. Replace some "egrep" uses by "grep -E" to promote the newer usage. Typeset "zgrep" as a command. Fix some spacing and punctuation bugs.
* Rewrite a poorly written usage example.Julian Foad2005-11-082-9/+16
| | | | | * doc/grep.texi: Rewrite a poorly written usage example about back-references, and tweak another. New text by Benno Schulenberg.
* * tests/foad1.sh: Duplicate three "-o -b" tests for the "-F"Charles Levert2005-11-042-0/+7
| | | | | mode because it relies on a different code path that deserves the same kind of testing.
* * src/grep.c (mb_icase_keys): New function to properly lowercaseCharles Levert2005-11-042-28/+73
| | | | | | | keys if match_icase. The problem was that some multi-octet characters can get longer or shorter upon this conversion, so that it cannot just naively be done in place on the same memory buffer. * src/grep.c (main): Call mb_icase_keys (and remove in-line code).
* typoStepan Kasal2005-09-272-2/+6
| | | | * doc/grep.1: Fix a typo.
* * src/grep.c (print_line_middle): In case of an empty match,Charles Levert2005-08-245-27/+61
| | | | | | | | | | make minimal progress and continue instead of aborting process of the remainder of the line, in case there's still an upcoming non-empty match. * tests/foad1.sh: Add two tests for this. * doc/grep.texi, doc/grep.1: Document this behavior, since --only-matching and --color are GNU extensions which are otherwise unspecified by POSIX or other standards.
* New pcre.sh regression test file (for "grep -P").Charles Levert2005-07-273-1/+22
| | | | | * tests/pcre.sh: New file. Add test 1. * tests/Makefile.am: Add pcre.sh to TESTS.
* * src/grep.c: Remove all xm capability code.Charles Levert2005-07-072-44/+7
|
* * src/kwset.c (kwsincr): When a second obstack_alloc() call fails,Charles Levert2005-07-052-1/+14
| | | | | | | | | free what the first one successfully allocated by popping it off the top of the obstack, before returning in error, just to keep things clean. * src/kwset.c (kwsprep): Verify return value of obstack_alloc() and return a memory exhausted error if so. This function had a prototype to return such errors, but never did.
* * src/kwset.c (DEPTH_SIZE): New macro to anticipateCharles Levert2005-07-052-2/+12
| | | | | | | architectures/compilers where CHAR_BIT is not 8 (we assume it won't be less than 4, which would be non-standard and unlikely). Checked to hold for CHAR_BIT up to 1023 (and maybe more)! * src/kwset.c (kwsincr): Use DEPTH_SIZE in two array declarations.
* * doc/grep.texi: Add missing green color in GREP_COLORS description.Charles Levert2005-07-053-28/+34
| | | | * doc/grep.1: Fix typo and reorganize GREP_COLORS documentation.
* Misplaced line, now superflous from last commit, removed.Charles Levert2005-07-041-1/+0
|
* * src/kwset.c (kwsprep): Optimize search for mind2 value byCharles Levert2005-07-042-3/+10
| | | | starting from the end of the target[] array.
* * src/kwset.c (kwsprep): Move three variable declarations toCharles Levert2005-07-042-2/+7
| | | | the single {}-block where they are used.
* * src/kwset.c (kwsprep): Use memset() and memcpy() when appropriate.Charles Levert2005-07-042-10/+5
|
* * src/kwset.c: Readability changes.Charles Levert2005-07-042-33/+39
| | | | | Replace uses of 0 for pointer values by NULL. Generalize use of existing U() macro to whole file.
* * grep/autogen.sh, grep/src/Makefile.am, grep/tests/backref.sh,Charles Levert2005-06-2316-15/+26
| | | | | | | | | | grep/tests/bre.sh, grep/tests/empty.sh, grep/tests/ere.sh, grep/tests/file.sh, grep/tests/fmbtest.sh, grep/tests/foad1.sh, grep/tests/khadafy.sh, grep/tests/options.sh, grep/tests/spencer1.sh, grep/tests/spencer2.sh, grep/tests/status.sh, grep/tests/warning.sh: As per autoconf's "Portable Shell Programming" guidelines, replace all instances of "#!/bin/sh" by "#! /bin/sh" (notice the space).
* * src/grep.c (color_cap_ne_fct, color_cap_xm_fct,Charles Levert2005-06-222-4/+8
| | | | print_line_middle, print_line_tail): Make these four functions static.
* * src/grep.c (prline): Simplifying rewrite usingCharles Levert2005-06-212-103/+37
| | | | | | | | | | | | | | | print_line_middle() and print_line_tail(). No longer attempts to find matches to colorize in context lines, thus avoiding costly calls to (*execute)(), since we know by then that they can't contain any by definition. There are no longer four different code paths whether -o and -i are each specified or not; they have been unified into one, which should help avoid bugs similar to previous ones due to not updating all code paths in a synchronized fashion. The -i code has been explicitly marked since it doesn't belong there and should be removed as soon as other -i code elsewhere is fixed. The remaining GREP_COLORS functionality is implemented. Savannah patch #3771 and patch #3644, heavily reworked.
* * src/grep.c (print_line_middle, print_line_tail): New functions,Charles Levert2005-06-212-1/+98
| | | | | unused for now, intended to allow a simplifying rewrite of prline(). Adding them first will make for cleaner CVS patches.
* * src/grep.c (print_offset): Renamed print_offset_sep() to betterCharles Levert2005-06-212-8/+50
| | | | | | represent its new functionality; new calling convention. * src/grep.c (print_offset, print_line_head): Use and implement missing parts of the GREP_COLORS and -T/--initial-tab frameworks.
* * src/grep.c: The new -T/--initial-tab framework, onlyCharles Levert2005-06-214-2/+49
| | | | | | | partially used at this point to make for a simpler initial patch in CVS. A subset of patch #3644 on Savannah. The option name/calling convention is the same as for GNU diff. * doc/grep.texi, doc/grep.1: Document -T/--initial-tab.
* * src/grep.c: The new GREP_COLORS (plural) framework, onlyCharles Levert2005-06-214-18/+285
| | | | | | | | | | partially used at this point to make for a simpler initial patch in CVS. A subset of patch #3644 on Savannah. * src/grep.c (color_cap_ne_fct, color_cap_xm_fct, print_filename, print_sep, parse_grep_colors): New functions. * src/grep.c (prtext, grepfile, main): Existing functions modified to use the new framework. * doc/grep.texi, doc/grep.1: Document GREP_COLORS.
* * src/grep.c (SEP_CHAR_MATCH, SEP_CHAR_CONTEXT, SEP_STR_CHUNK):Charles Levert2005-06-212-8/+16
| | | | | New macros for ':', '-', and "--". Used throughout the file. Will be used even more in upcoming updates, so good to have now.
* * tests/foad1.sh: Add tests combining -o, -n/-b/-H, and -i,Charles Levert2005-06-213-5/+41
| | | | | | | | | | | | | | | | since there are separate code paths for -i. Add tests combining -o, -n/-b/-H, and -3, since any context line specification should be ignored when combined with -o. * src/grep.c (print_line_head): New function, culled off the top content of prline(). Adds a guard against "lastnl" having already reached "lim", which can happen when if the function is called more than once per line. * src/grep.c (prline): Now calls print_line_head(), not only at the beginning to replace the moved code when -o is not specified, but also for each match when -o is specified (two code paths with this). Patch #3770, more or less. This makes all tests combining -o and -n/-b/-H pass, which they didn't before. Fixes bug #12727.
* * src/grep.c (main): Add a test to check if -o/--only-matchingCharles Levert2005-06-212-0/+16
| | | | | | | | | and context lines are both specified and if so, set both context specifications (before and after) to zero then print an explicit warning to stderr explaining what was done and why (as opposed to drastically aborting the process in error). Patch #3768. Other code needs this zero setting to work correctly without having to repeatedly test for this conflictual condition.