summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* grep.morph: use autotools with overridebaserock/bootstrap-pass1Richard Maw2012-03-141-7/+2
| | | | | disable-perl-regexp is needed as pcre is available on the host system but will not be available on /tools
* DESTDIR change in installbaserock/bootstrap-stablebaserock/bootstrapAdnan Ali2012-01-311-1/+1
|
* add the output of bootstrap, remove step from morphRichard Maw2012-01-119449-124/+1209811
|
* add morphRichard Maw2012-01-111-0/+14
|
* doc: document empty pattern betterPaul Eggert2012-01-041-1/+15
| | | | | | | * doc/grep.texi (Top, Fundamental Structure, Usage): Explain how grep deals with the empty pattern. Problem spotted by Bernhard Voelker in <http://lists.gnu.org/archive/html/bug-grep/2012-01/msg00050.html>.
* grep: with no args, search "." only if command-line -rPaul Eggert2012-01-044-13/+38
| | | | | | | | | * NEWS: Document this. * doc/grep.texi (Environment Variables, grep Programs): Likewise. * src/main.c (usage): Likewise. (main): Implement this. (prepend_default_options): Return a count of prepended options. * tests/r-dot: Test the above.
* tests: adjust test to match code, now that --mmap writes to stderrJim Meyering2012-01-031-2/+6
| | | | * tests/ignore-mmap: Separate stdout and stderr; test both.
* deprecate the --mmap optionJim Meyering2012-01-033-2/+12
| | | | | | | | * src/main.c (main): Deprecate the --mmap option: issue a warning when it is used. (usage): Change description. * doc/grep.texi (Other Options): Document the new behavior. * NEWS (Changes in behavior): Mention it.
* dfa: fix incorrect commentPaolo Bonzini2012-01-031-1/+1
| | | | * src/dfa.c (dfastate): Fix comment for newline.
* dfa: fix rebase conflictPaolo Bonzini2012-01-031-1/+1
| | | | * src/dfa.c (dfaanalyze): Fix reference to nalloc.
* dfa: automatically resize position_setsPaolo Bonzini2012-01-031-14/+12
| | | | | | * src/dfa.c (insert, copy, merge): Resize arrays here. (dfaanalyze): Do not track number of allocated elements here. (dfastate): Allocate mbps with only one element.
* dfa: change position_set nelem to size_tPaolo Bonzini2012-01-031-2/+1
| | | | | | * src/dfa.c (REALLOC_IF_NECESSARY): Disable assertion, to avoid warnings from -Wtype-limits. (position_set): Change nelem to a size_t.
* dfa: move nalloc to position_set structurePaolo Bonzini2012-01-031-8/+6
| | | | | | * src/dfa.c (position_set): Add alloc. (alloc_position_set): Initialize it. (dfaanalyze): Use it instead of the nalloc array or nelem.
* dfa: remove dead assignmentPaolo Bonzini2012-01-031-1/+0
| | | | | * src/dfa.c (transit_state): transit_state_consume_1char will clear follows, do not do this ourselves.
* dfa: introduce alloc_position_setPaolo Bonzini2012-01-031-8/+14
| | | | * src/dfa.c (alloc_position_set): New function, use it throughout.
* dfa: use a more compact data type for grpsPaolo Bonzini2012-01-031-8/+17
| | | | | | * src/dfa.c (leaf_set): New. (dfastate): Use the smaller type, leaf_set, for grps. Its prior type contained an unused constraint field.
* dfa: use MALLOC/REALLOC alwaysPaolo Bonzini2012-01-031-4/+4
| | | | src/dfa.c (dfastate, enlist, dfamust): Use MALLOC and REALLOC.
* dfa: remove unnecessary bracesPaolo Bonzini2012-01-031-3/+1
| | | | * src/dfa.c (dfastate): Remove unnecessary braces.
* dfa: x2nrealloc starting from a NULL pointer worksPaolo Bonzini2012-01-031-12/+1
| | | | | * src/dfa.c (parse_bracket_exp): Do not MALLOC mbcset parts the first time they are encountered. Initialize chars_al correctly.
* build: avoid build failure with --enable-gcc-warnings and recent gccJim Meyering2012-01-031-0/+6
| | | | | * lib/colorize-posix.c: Disable -Wsuggest-attribute=const, to avoid warning about this empty init_colorize function.
* remove lib/ms/Paolo Bonzini2012-01-037-8/+8
| | | | | | | | | | * configure.ac: Create lib/colorize.c as a symbolic link. * lib/colorize-posix.c: New name of lib/colorize-impl.c. * lib/colorize-w32.c: New name of lib/ms/colorize-impl.c. * lib/colorize.c: Delete. * lib/Makefile.am (EXTRA_DIST): Adjust. * .gitignore: Adjust. * cfg.mk: Adjust syntax-check exclusions.
* unify colorize.h headersPaolo Bonzini2012-01-035-24/+22
| | | | | | | | * lib/Makefile.am (EXTRA_DIST): Adjust. * lib/colorize.h: Remove inline functions. * lib/colorize-impl.c: Move them here as functions. * lib/ms/colorize.h: Remove. * src/Makefile.am (DEFAULT_HEADERS): Remove.
* colorize: use isatty modulePaolo Bonzini2012-01-037-26/+14
| | | | | | | | | | * bootstrap.conf: Add isatty module. * gnulib: Update to latest. * lib/colorize.h: Remove argument from should_colorize. * lib/ms/colorize.h: Likewise. * lib/colorize-impl.c: Factor isatty call out of here... * lib/ms/colorize-impl.c: ... and here... * src/main.c: ... into here.
* tests: avoid minor "make check" failureJim Meyering2012-01-031-0/+0
| | | | | * tests/r-dot: Make executable, to avoid triggering a failed consistency test in "make check".
* grep: -r with no args now searches "."Paul Eggert2012-01-025-21/+60
| | | | | | | | | | | | | | | | | | | This is a patch I've been meaning to put in for years. When I added support for "grep -r", I forgot to have "grep -r PAT" search the working directory by default, instead of searching standard input (which makes no sense, even if stdin is a directory). This is not an upward compatible change, since "grep -r PAT <file" will no longer search standard input, but that's OK; nobody should be using "grep -r" that way anyway. * NEWS: Document this. * doc/grep.texi (File and Directory Selection, grep Programs, Usage): Likewise. * src/main.c (usage): Likewise. (grepdir): If DIR is null, search the working directory, but do not prepend "./" to the file names. (main): If recursing and no operands are given, search ".". * tests/Makefile.am (TESTS): Add r-dot. * tests/r-dot: New file.
* grep: prefer fgets to printf, _ to gettextPaul Eggert2012-01-023-4/+4
| | | | | | | * lib/colorize.h (print_end_colorize): * lib/ms/colorize-impl.c (print_end_colorize): Use fputs instead of printf. * src/main.c (usage): Likewise. Use _ instead of gettext.
* grep: check stdin like other filesPaul Eggert2012-01-013-59/+86
| | | | | | | | | | | * NEWS: Document this. * src/main.c (grepfile): Revamp tests for input files so that standard input is tested like other files. For example, report an error if standard input equals standard output. Prefer open+fstat to stat+open if possible, as open+fstat is usually a bit faster and avoids a race condition. * tests/in-eq-out-infloop: Add tests for cases like 'grep pat <file >>file'.
* maint: update all copyright year number rangesJim Meyering2012-01-0171-71/+72
| | | | Run "make update-copyright".
* grep: lower-case function namesPaul Eggert2011-12-311-19/+19
| | | | | | | | | These names used to be macros, but they're functions now. All callers changed. * src/main.c (pr_sgr_start): Rename from PR_SGR_START. (pr_sgr_end): Rename from PR_SGR_END. (pr_sgr_start_if): Rename from PR_SGR_START_IF. (pr_sgr_end_if): Rename from PR_SGR_END_IF.
* ms: move Microsoft-specific stuff to lib/msPaul Eggert2011-12-3110-226/+337
| | | | | | | | | | | | | | | | | | | | | | | * cfg.mk (exclude_file_name_regexp--sc_prohibit_strcmp) (exclude_file_name_regexp--sc_require_config_h) (exclude_file_name_regexp--sc_require_config_h_first): New rules. * lib/colorize.c, lib/colorize.h, lib/colorize-impl.c: * lib/ms/colorize.h, lib/ms/colorize-impl.c: New files. * configure.ac (GREP_SRC_INCLUDES): New macro. * lib/Makefile.am (libgreputils_a_SOURCES): Add colorize.[ch]. (EXTRA_DIST): New macro. * src/Makefile.am (DEFAULT_INCLUDES): New macro. * src/main.c: Include colorize.h. (PR_SGR_START, PR_SGR_END, PR_SGR_START_IF, PR_SGR_END_IF): Now static functions, not macros. (hstdout, norm_attr, w32_console_init, w32_sgr2attr) (w32_clreol) [__MINGW32__]: Move to lib/ms/colorize-impl.c. (pr_sgr_start, pr_sgr_end): Remove; callers changed to use new print_start_colorize, print_end_colorize from colorize.h. (init_colorize): Rename from w32_console_init and move to colorize module; caller changed. (should_colorize): Move to colorize module.
* grep: do input==output check more like dir loop checkPaul Eggert2011-12-312-41/+2
| | | | | | | | | | * src/main.c (grepfile): Just use SAME_INODE; don't bother with SAME_REGULAR_FILE. This works better on properly-working POSIX hosts, since it handles the case where the file is changing as we grep it. It works worse on hosts that don't support st_ino properly, but in practice this isn't that much of a problem here. * src/system.h (same_file_attributes, SAME_REGULAR_FILE): Remove; no longer needed.
* build: update gnulib submodule to latestPaul Eggert2011-12-311-0/+0
|
* maint: remove now-unused/obsolete filesPaul Eggert2011-12-283-92/+0
| | | | | | * README.DOS: Remove file. * m4/djgpp.m4: Likewise. * .gitignore: Remove reference to m4/djgpp.m4.
* maint: distribute ChangeLog-2009Jim Meyering2011-12-281-0/+1
| | | | | * Makefile.am (EXTRA_DIST): Add ChangeLog-2009. Spotted by Eli Zaretskii.
* main.c: add some 'const' directivesJim Meyering2011-12-281-4/+4
| | | | | | * src/main.c (color_dict, fg_color, bg_color, cap): Declare const. No semantic change.
* main.c: correct indentation and formatting styleJim Meyering2011-12-281-155/+156
| | | | | * src/main.c: Correct many formatting inconsistencies. No semantic change.
* avoid new syntax-check failuresJim Meyering2011-12-282-64/+63
| | | | | | * cfg.mk (old_NEWS_hash): Update, to accommodate old NEWS modification. * src/main.c: Indent solely with spaces, never with TABs. (should_colorize): Remove useless parens in #if directive.
* Fix whitespace, indentation and documentationEli Zaretskii2011-12-281-10/+11
| | | | | * src/main.c (parse_grep_colors): Fix indentation. (usage): Mention MS-Windows in help text for -U and -u options.
* update NEWS for MS-Windows changesEli Zaretskii2011-12-281-1/+7
| | | | * NEWS: Mention MS-Windows related bugfixes and enhancements.
* Fix the test suite for MS-Windows.Eli Zaretskii2011-12-283-2/+3
| | | | | | | | * tests/include-exclude: Use --directories=skip, to avoid gratuitous failures on systems that cannot grep directories. * tests/reversed-range-endpoints: Don't reject program names with leading directories and drive letters. * tests/warn-char-classes: Likewise.
* Support color highlighting on MS-WindowsEli Zaretskii2011-12-281-18/+228
| | | | | | | | | * src/main.c (SGR_START, SGR_END, PR_SGR_FMT, PR_SGR_FMT_IF): Remove. (PR_SGR_START, PR_SGR_START_IF): Replace with pr_sgr_start. (PR_SGR_END, PR_SGR_END_IF): Replace with pr_sgr_end. (pr_sgr_start, pr_sgr_end, should_colorize): New functions. (w32_console_init, w32_sgr2attr, w32_clreol) [__MINGW32__]: New functions. (main): Use should_colorize. Invoke w32_console_init.
* don't ignore errors when reading a directoryPaul Eggert2011-12-243-41/+11
| | | | | | | | | | | grep no longer silently suppresses errors when reading a directory as if it were a text file. For example, "grep x ." now reports a read error on most systems; formerly, it ignored the error. Problem reported as an aside by Bob Proulx (Bug#10355). * NEWS: Document this. * src/main.c (grep, grepfile): Implement this. Simplify the code considerably. * src/system.h (is_EISDIR): Remove; no longer needed.
* --include etc. now work on command-line args more consistentlyPaul Eggert2011-12-243-9/+31
| | | | | | | | | | --include and --exclude apply only to non-directories and --exclude-dir applies only to directories. "-" (standard input) is never excluded, since it is not a file name. This bug was discovered while fixing a read-directory bug (Bug#10355). * NEWS: Document this. * src/main.c (main): Implement this. * tests/include-exclude: Test for it.
* build: update gnulib submodule to latestJim Meyering2011-12-241-0/+0
|
* doc: improve grep.texiArnold D. Robbins2011-12-121-154/+190
| | | | | * doc/grep.texi: General editing for improved aesthetics. Also fix a few problems.
* build: use gnulib's iswctype wcscollJim Meyering2011-12-123-13/+4
| | | | | | | | | * bootstrap.conf (gnulib_modules): Add iswctype and wcscoll. * configure.ac: Remove explicit checks for those functions. * src/mbsupport.h (MBS_SUPPORT): Define to 1 if not already defined. Remove the conditional, now that we're guaranteed by gnulib to have wcscoll and iswctype. Suggested by Alan Hourihane in http://savannah.gnu.org/bugs/?34930
* disable the new input==output guard for additional optionsJim Meyering2011-12-123-4/+35
| | | | | | | * src/main.c (grepfile): Do not reject input == output also when using a few other options. * tests/in-eq-out-infloop: Test these new cases. * NEWS (Bug fixes): Mention it
* do not reject "grep -qr . > out"Nicolas Vigier2011-12-111-2/+4
| | | | | | | | | | | | The recent fix to avoid an infinite disk-filling loop, commit 5e20a38a, introduced a minor regression. If you use grep with -q and -r, and redirect output to a file that will be traversed, then grep would reject the command, even though it will generate no output. In that case, there is no risk of an infinite loop. * src/main.c (grepfile): Do not reject input == output when using --quiet/--silent (-q). Reported by J H Wilson in http://bugs.mageia.org/show_bug.cgi?id=3501 forwarded by Nicolas Vigier to https://savannah.gnu.org/bugs/?34917
* dfa: do not call nl_langinfo in !MBS_SUPPORT modeArnold Robbins2011-11-291-1/+1
| | | | | | * src/dfa.c (using_utf8) [!MBS_SUPPORT]: Remove erroneous "defined" in cpp test for MBS_SUPPORT. Since commit a163349d, MBS_SUPPORT is 0/1. This error caused trouble only in the !MBS_SUPPORT case.
* dfa: avoid warning from deficient compiler in !MBS_SUPPORT modeArnold Robbins2011-11-291-1/+7
| | | | | * src/dfa.c (setbit_wc) [!MBS_SUPPORT]: Add explicit "return false;" after "abort ();", to avoid a warning from deficient compilers.