| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
| |
* src/grep.c (usage): consistent punctuation.
|
|
|
|
| |
* src/grep.c (usage): mention gnu.org/s/grep and gnu.org/gethelp.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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/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). Thanks
to Emanuele Giaquinta for this.
|
|
|
|
|
|
|
|
|
| |
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 year
|
|
|
|
|
|
|
| |
* 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. Thanks to
Johan Walles for this. Patch #6288
|
|
|
|
|
|
|
| |
* src/.cvsignore: add .deps
* .cvsignore: add configure.ac
* src/.cvsignore: add .deps
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
| |
|
|
|
|
|
| |
* lib/savedir.c, lib/savedir.h, src/grep.c, doc/*:
Add --exclude-dir option (patch #5051)
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
--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.
|
|
|
|
|
|
| |
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>.
|
|
|
|
|
|
| |
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.)
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
| |
with the mb_icase_keys() function, which can call xrealloc() or
free() on keys, by making sure keys is always dynamically allocated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
| |
starting from the end of the target[] array.
|
|
|
|
| |
the single {}-block where they are used.
|
| |
|
|
|
|
|
| |
Replace uses of 0 for pointer values by NULL.
Generalize use of existing U() macro to whole file.
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
| |
print_line_middle, print_line_tail): Make these four functions static.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
unused for now, intended to allow a simplifying rewrite of
prline(). Adding them first will make for cleaner CVS patches.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
New macros for ':', '-', and "--". Used throughout the file.
Will be used even more in upcoming updates, so good to have now.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
--color screen attributes (SGR parameters).
|
| |
|