summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* move .cvsignore files to .gitignorePaolo Bonzini2009-11-202-6/+3
|
* (usage): one more tweak to the --help output.Karl Berry2009-02-011-1/+1
|
* punctuation in --help messageKarl Berry2009-02-011-1/+1
| | | | * src/grep.c (usage): consistent punctuation.
* mention urls in help msgKarl Berry2009-01-301-0/+5
| | | | * src/grep.c (usage): mention gnu.org/s/grep and gnu.org/gethelp.
* update/add copyright noticesKarl Berry2009-01-3012-7/+96
|
* * lib/savedir.c (isdir): New declaration.Tony Abou-Assaleh2009-01-253-20/+23
| | | | | | | | | | | | | | | | | | | * src/dfa.c (update_mb_len_index): Change argument type to 'char const *'. (match_mb_charset): Cast argument to strncpy. (dfaexec): Add pointer cast. * src/grep.c (parse_grep_colors): Add braces for disambiguation. * src/kwset.c: Include xalloc.h instead of declaring xmalloc manually. * lib/savedir.c (isdir): New declaration. * src/dfa.c (update_mb_len_index): Change argument type to 'char const *'. (match_mb_charset): Cast argument to strncpy. (dfaexec): Add pointer cast. * src/grep.c (parse_grep_colors): Add braces for disambiguation. * src/kwset.c: Include xalloc.h instead of declaring xmalloc manually.
* * tests/foad1.sh: disable tests that fail under cs_CZ.UTF-8.Tony Abou-Assaleh2009-01-211-2/+2
| | | | | | | * tests/fmbtest.sh: likewise * tests/foad1.sh: disable tests that fail under cs_CZ.UTF-8. * tests/fmbtest.sh: likewise
* src/ansi2knr.[1c]: Remove generated files (installed by automake).Tony Abou-Assaleh2008-06-152-714/+0
| | | | | * src/ansi2knr.[1c]: Remove generated files (installed by automake). Thanks to Emanuele Giaquinta for this.
* * src/grep.c: Factor out copyright year in --version. Thanks toTony Abou-Assaleh2008-02-141-4/+4
| | | | | | | | | Karl Berry for this. * src/grep.c: Update copyright years * src/grep.c: Factor out copyright year in --version. Thanks to Karl Berry for this. * src/grep.c: Update copyright years
* * src/grep.c: Update grep copyright yearTony Abou-Assaleh2008-02-101-1/+1
| | | | * src/grep.c: Update grep copyright year
* * README-alpha: more info about CVS codeTony Abou-Assaleh2008-02-101-1/+2
| | | | | | | * README: pointer to README-alpha * README-alpha: more info about CVS code * README: pointer to README-alpha
* * src/dfa.c: Replace a MALLOC and for loop with a CALLOC.Tony Abou-Assaleh2008-02-091-3/+1
| | | | | * src/dfa.c: Replace a MALLOC and for loop with a CALLOC. Thanks to Johan Walles for this. Patch #6288
* * .cvsignore: add configure.acTony Abou-Assaleh2008-02-081-0/+1
| | | | | | | * src/.cvsignore: add .deps * .cvsignore: add configure.ac * src/.cvsignore: add .deps
* * Re-commit changes of 2007-10-07Tony Abou-Assaleh2007-10-101-3/+6
| | | | | | | | | | | | | | * configure.ac.in: update version to 2.6-dev * src/grep.c: update --version message * configure.ac.in: update version to 2.6-dev * src/grep.c: update --version message * src/grep.c: When -h and -H are combined, use the last specified, Bug #15620, Patch #4866 * tests/foad1.sh: add tests for -h and -H * ChangeLog: Add a copyright notice (years taken from commit logs), add a license notice (taken from gnulib ChangeLog) * TODO: update the link to a list of other grep implementations
* Revert changes since grep-2.5.3 release to add a tag to CVS.v2.5.3Tony Abou-Assaleh2007-10-101-2/+0
|
* * src/grep.c: When -h and -H are combined, use the last specified,Tony Abou-Assaleh2007-10-071-0/+2
| | | | | | | | | | | | | | | Bug #15620, Patch #4866 * tests/foad1.sh: add tests for -h and -H * ChangeLog: Add a copyright notice (years taken from commit logs), add a license notice (taken from gnulib ChangeLog) * TODO: update the link to a list of other grep implementations * src/grep.c: When -h and -H are combined, use the last specified, Bug #15620, Patch #4866 * tests/foad1.sh: add tests for -h and -H * ChangeLog: Add a copyright notice (years taken from commit logs), add a license notice (taken from gnulib ChangeLog) * TODO: update the link to a list of other grep implementations
* GPLv2 -> GPLv3Bernhard Rosenkraenzer2007-06-289-9/+9
|
* --exclude-dirBernhard Rosenkraenzer2006-08-181-4/+20
| | | | | * lib/savedir.c, lib/savedir.h, src/grep.c, doc/*: Add --exclude-dir option (patch #5051)
* Remove bogus warningBernhard Rosenkraenzer2006-08-181-6/+0
|
* On 2005-06-21, many changes were made that affected --color,Charles Levert2005-11-171-42/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | --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-161-1/+1
| | | | | | 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>.
* * src/grep.c (parse_grep_colors, main): Replace all uses ofCharles Levert2005-11-111-16/+11
| | | | | | 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-111-1/+3
| | | | | | | 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.
* The introduction of the --only-matching and --color GNU extensionsCharles Levert2005-11-103-94/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-101-2/+4
| | | | | with the mb_icase_keys() function, which can call xrealloc() or free() on keys, by making sure keys is always dynamically allocated.
* The following set of changes aims to make "egrep" and "fgrep"Charles Levert2005-11-099-275/+257
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-081-1/+1
| | | | | | | | | | | | 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.
* * src/grep.c (mb_icase_keys): New function to properly lowercaseCharles Levert2005-11-041-28/+65
| | | | | | | 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).
* * src/grep.c (print_line_middle): In case of an empty match,Charles Levert2005-08-241-12/+29
| | | | | | | | | | 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.
* * src/grep.c: Remove all xm capability code.Charles Levert2005-07-071-44/+3
|
* * src/kwset.c (kwsincr): When a second obstack_alloc() call fails,Charles Levert2005-07-051-1/+6
| | | | | | | | | 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-051-2/+6
| | | | | | | 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.
* 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-041-3/+7
| | | | starting from the end of the target[] array.
* * src/kwset.c (kwsprep): Move three variable declarations toCharles Levert2005-07-041-2/+4
| | | | the single {}-block where they are used.
* * src/kwset.c (kwsprep): Use memset() and memcpy() when appropriate.Charles Levert2005-07-041-10/+3
|
* * src/kwset.c: Readability changes.Charles Levert2005-07-041-33/+33
| | | | | 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-231-1/+1
| | | | | | | | | | 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-221-4/+4
| | | | print_line_middle, print_line_tail): Make these four functions static.
* * src/grep.c (prline): Simplifying rewrite usingCharles Levert2005-06-211-103/+23
| | | | | | | | | | | | | | | 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-211-0/+93
| | | | | 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-211-8/+45
| | | | | | 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-211-1/+10
| | | | | | | 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-211-6/+196
| | | | | | | | | | 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-211-8/+12
| | | | | 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-211-5/+18
| | | | | | | | | | | | | | | | 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-211-0/+8
| | | | | | | | | 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.
* * src/grep.c (nlscan): Make this function more robust by removingCharles Levert2005-06-211-2/+7
| | | | | | the undocumented assumption that its "lim" argument points right after a line boundary. This will be used later to fix --byte-offset's broken behavior. Patch #3769.
* * src/grep.c: Explain the context and logic for choosing defaultCharles Levert2005-06-211-3/+45
| | | | --color screen attributes (SGR parameters).
* * src/grep.c: Extensively document the SGR/EL-to-Right issue.Charles Levert2005-06-211-2/+57
|