80 Commits

Author SHA1 Message Date
Jim Meyering
c635f7dd92 maint: update copyright dates 2026-01-02 16:42:12 -08:00
Paul Eggert
b1eaccd96d maint: update all copyright dates via "make update-copyright" 2025-01-01 19:15:26 -08:00
Jim Meyering
1c9e7544cf maint: modernize GNU GPL license comments
To accommodate a new syntax-check rule, ...
Make comments that suggested to write to an old FSF Franklin Street
address refer to https://www.gnu.org/licenses instead:

  git grep -l 'if not, write' |xargs \
  perl -0777 -pi -e 's{program; if not, write .*? USA\.}{program.  If not, see <https://www.gnu.org/licenses/>.}ms'
2024-09-08 09:45:52 -07:00
Jim Meyering
e248db797a maint: update all copyright dates via "make update-copyright" 2024-01-05 09:19:41 -08:00
Paul Eggert
102be2bfa5 grep: prefer nullptr to NULL
* bootstrap.conf (gnulib_modules): Add nullptr.
All uses of NULL eliminated or changed to nullptr,
modernizing us from C89 to C23.
2023-09-14 01:01:02 -05:00
Jim Meyering
45e1158a4b maint: update copyright dates 2023-01-01 20:36:23 -08:00
Jim Meyering
f9290127f3 maint: make update-copyright 2022-01-01 10:29:09 -08:00
Paul Eggert
e84a2ea9d2 maint: run "make update-copyright" 2021-01-01 19:00:09 -08:00
Jim Meyering
5909bc45ad maint: update all copyright year number ranges
Run "make update-copyright" and then...
* gnulib: Update to latest with copyright year adjusted.
* tests/init.sh: Sync with gnulib to pick up copyright year.
* bootstrap: Likewise.
* doc/grep.in.1: Use "-" in copyright year ranges, not \en.
2020-01-01 09:12:07 -08:00
Jim Meyering
1019e6e35a maint: update all copyright dates via "make update-copyright"
* gnulib: Also update submodule for its copyright updates.
2019-01-01 19:00:38 -08:00
Paul Eggert
7a89c66674 maint: update URLs
Mostly this is just changing http: to https:.
In one or two places it removes no-longer-useful URLs.
2018-04-21 13:47:28 -07:00
Jim Meyering
e8feb1ce5c maint: update gnulib and copyright dates for 2018
* gnulib: Update to latest.
* all files: Run "make update-copyright".
* bootstrap: Update from gnulib.
2018-01-06 16:14:06 -08:00
Jim Meyering
3cd2e8625a maint: update gnulib and copyright dates for 2017
* gnulib: Update to latest.
* all files: Run "make update-copyright".
2017-01-01 03:34:33 -08:00
Jim Meyering
c65dcd72d1 maint: update copyright year, bootstrap, init.sh
Run "make update-copyright" and then...

* gnulib: Update to latest.
* tests/init.sh: Update from gnulib.
* bootstrap: Likewise.
2016-01-01 14:34:20 -08:00
Jim Meyering
d433dad3f4 maint: update copyright year ranges to include 2015
Run "make update-copyright".  Also, ...
* grep.texi: Update manually, converting each "--" to "-".
2015-01-01 18:55:33 -08:00
Paul Eggert
824e153412 build: don't make output files read-only
This led to problems, such as the prompt "mv: try to overwrite
'egrep', overriding mode 0555 (r-xr-xr-x)? " during a build.
It can be worked around, but the cure is worse than the disease;
making output files read-only is more trouble than it's worth.
* doc/Makefile.am (grep.1, egrep.1, fgrep.1):
* lib/Makefile.am (colorize.c):
* src/Makefile.am (egrep fgrep):
Don't make output files read-only.  Prefer separate commands to
'&&' when either will do.
2014-06-17 12:06:06 -07:00
Jim Meyering
b98cf069c3 build: don't redirect directly to $@
* lib/Makefile.am (colorize.c): Don't redirect directly to target, $@.
Otherwise, we could create a corrupt colorize.c file with a
timestamp that indicates it is up to date.
Also, make the generated file read-only.
2014-06-06 08:57:56 -07:00
Paul Eggert
085f98bba1 dist: don't distribute lib/colorize.c
'configure' creates this file, so it shouldn't be distributed; see:
http://bugs.gnu.org/17480
* configure.ac (COLORIZE_SOURCE): New macro.
Don't use AC_CONFIG_LINKS for lib/colorize.c.
* lib/Makefile.am (nodist_libgreputils_a_SOURCES): New macro.
(libgreputils_a_SOURCES): Remove colorize.c.
(CLEANFILES): Add colorize.c
(colorize.c): New rule.
2014-05-24 13:38:34 -07:00
Jim Meyering
d562c071b6 maint: update copyright dates for 2014
Do that by running "make update-copyright".
2014-01-01 14:54:47 -08:00
Stefano Lattarini
8debdc1d8c build: remove redundant use of $(INCLUDES)
* lib/Makefile.am (INCLUDES): Remove.  Automake automatically adds
$(srcdir) and $(top_builddir) to the C preprocessor search path.
INCLUDES is deprecated in Automake 1.13 (causing a runtime
warning), and will be removed in Automake 1.14.
2013-01-11 08:07:50 -08:00
Jim Meyering
0b2d2da071 maint: update all copyright year number ranges
Run "make update-copyright".
2013-01-04 11:12:05 +01:00
Paul Eggert
6c4a43ab84 maint: quote 'like this' or "like this", not `like this'
See <http://lists.gnu.org/archive/html/bug-grep/2012-01/msg00125.html>.
* ChangeLog-2009, HACKING, NEWS, README-hacking, cfg.mk, configure.ac:
* lib/colorize-w32.c, m4/pcre.m4:
* src/Makefile.am, src/dfa.c, src/dosbuf.c, src/main.c:
* tests/backref, tests/help-version, tests/tests:
In commentary, quote 'like this' or "like this" rather than
`like this' or ``like this''.
* cfg.mk (old_NEWS_hash): Update due to changed old NEWS.
* doc/grep.texi (General Output Control): Quote sample text
with @samp, not with `...'.
* src/main.c (usage):
* tests/help-version: Quote 'like this' rather than `like this'
in diagnostics.
2012-05-06 16:19:33 -07:00
Paul Eggert
c6e3ea61d9 grep: -r no longer follows symlinks; use fts
Change -r to follow only command-line symlinks, and by default to
read only devices named on the command line.  This is a simple
way to get a more-useful behavior when searching random
directories; the idea is to use 'find' if you want something fancy.
-R acts as before and gets a new alias --dereference-recursive.
The code now uses fts internally, so it is more robust and
faster with large hierarchies.
* .gitignore: Remove lib/savedir.c, lib/savedir.h.
* tests/symlink: New file
* Makefile.boot (LIB_OBJS_core): Remove isdir.o, savedir.o.
Perhaps other changes are needed too, but I'm not sure what
this makefile is for.
* NEWS: Document changes.
* doc/grep.texi (File and Directory Selection): Likewise.
* bootstrap.conf (gnulib_modules): Remove dirent, dirname, isdir, open.
Add fstatat, fts, openat-safer.
* lib/Makefile.am (libgreputils_a_SOURCES): Remove savedir.c, savedir.h.
* lib/savedir.c, lib/savedir.h: Remove.
* po/POTFILES.in: Add lib/openat-die.c.
* src/main.c: Include fcntl-safer.h, fts_.h.  Don't include
isdir.h, savedir.h.
(struct stats, stats_base): Remove.
(long_options, usage, main): Add --dereference-recursive and
implement -r vs -R.
(filename_prefix_len, fts_options): New static vars.
(basic_fts_options, READ_COMMAND_LINE_DEVICES): New constants.
(devices): Now defaults to READ_COMMAND_LINE_DEVICES.
(reset, grep): Now takes just struct stat rather than file name and
struct stats.  All callers changed.
(fillbuf): Now takes struct stat reather than struct stats.
All callers changed.
(grep): Don't worry about recursing too deeply; fts and grepdesc
handle this now.
(is_device_mode, grepdirent, grepdesc, grep_command_line_args):
New functions.
(grepfile): New args DIRDESC, FOLLOW, COMMAND_LINE.  Remove struct stats
arg.  All callers changed.  Use openat_safer rather than open.
Use desc == STDIN_FILENO to tell whether we're reading "-".
Don't worry about EINTR when closing -- not possible, since we're
not catching signals.
* tests/Makefile.am (TESTS): Add symlink.
* tests/symlink: New file.
2012-03-14 22:28:27 -07:00
Jim Meyering
75b74e442f build: update bootstrap from gnulib and adapt
* bootstrap: Update from gnulib.
* tests/init.sh: Update from gnulib.
* bootstrap.conf (bootstrap_epilogue): Remove now-unnecessary,
snippet that edited gnulib-tests/gnulib.mk.
(gnulib_tool_option_extras): Add both --symlink and
--makefile-name=gnulib.mk.  Remove use of $bt.
* lib/Makefile.am: Initialize numerous automake variables so that
generated code in gnulib.mk may use += to append to them.
2012-01-22 11:41:39 +01:00
Jim Meyering
082f0d1a77 build: avoid build failure with --enable-gcc-warnings and recent gcc
* lib/colorize-posix.c: Disable -Wsuggest-attribute=const, to avoid
warning about this empty init_colorize function.
2012-01-03 10:26:58 +01:00
Paolo Bonzini
a00ff6423c remove lib/ms/
* 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.
2012-01-03 09:25:59 +01:00
Paolo Bonzini
9871ae6543 unify colorize.h headers
* 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.
2012-01-03 09:25:39 +01:00
Paolo Bonzini
3f99160691 colorize: use isatty module
* 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.
2012-01-03 08:54:29 +01:00
Paul Eggert
4c6a1dcd64 grep: prefer fgets to printf, _ to gettext
* 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.
2012-01-02 02:16:27 -08:00
Jim Meyering
5b2201913f maint: update all copyright year number ranges
Run "make update-copyright".
2012-01-01 09:28:52 +01:00
Paul Eggert
4f61a0530c ms: move Microsoft-specific stuff to lib/ms
* 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.
2011-12-31 19:40:20 -08:00
Jim Meyering
e5195e9473 maint: remove unneeded #include directives
* lib/savedir.c: Don't include <stddef.h>.  Not needed.
* src/dfa.c: Likewise.
2011-01-26 18:55:39 +01:00
Jim Meyering
daaf7ce73d maint: update copyright year ranges to include 2011
Run "make update-copyright", so "make syntax-check" works in 2011.
2011-01-03 22:18:55 +01:00
Jim Meyering
699bcc4bd8 convert all TABs to equivalent spaces in indentation
Using this file,

cat > leading-blank.exempt <<\EOF
(?:^|\/)ChangeLog[^/]*$
(?:^|\/)(?:GNU)?[Mm]akefile[^/]*$
\.(?:am|mk)$
EOF

run this command to convert all non-conforming leading white
space to be all spaces:

git ls-files \
  | pcregrep -vf leading-blank.exempt \
  | xargs pcregrep -l '^ *\t' \
  | xargs perl -MText::Tabs -ni -le \
    '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'
2010-04-08 19:29:42 +02:00
Eric Blake
e8090680ba build: avoid warnings on cygwin
* lib/savedir.c (isdir): Avoid shadowing a declaration.
* src/main.c (get_nondigit_option): Cast away const to avoid
compiler warning.
2010-03-29 11:31:59 -06:00
Jim Meyering
da3d9ebff4 grep -r: fix --include with non-globs
* lib/savedir.c (savedir): Fix logic error.  Introduced by commit
bf3bd92c, "build: adapt to the newer exclude API we now get from gnulib"
* tests/include-exclude: Test for this bug by exercising --include, too.
* NEWS (Bug fixes): Mention it.
Reported by Philipp Kohlbecher in http://savannah.gnu.org/bugs/?29358
2010-03-28 20:59:00 +02:00
Jim Meyering
54d55bba41 grep: don't segfault upon use of --include or --exclude* options
* lib/savedir.c (isdir1): Fix fatal typo: deref "dir" argument,
not the global (initially-NULL) "path".  Reported by Standish Parsley.
* tests/include-exclude: New file.
* tests/Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.
2010-03-27 10:11:58 +01:00
Jim Meyering
bed24c8e8a maint: remove all uses of PARAMS
* lib/savedir.h (PARAMS): Remove definitions manually.
Remove the remaining ones via this command:
  git grep -l define.PARAMS |xargs perl -ni -e '/define PARAMS/ or print'
* src/dfa.h (PARAMS): Remove definitions.
* src/system.h (PARAMS): Likewise.
Remove most uses with this:
  git grep -lw PARAMS |xargs perl -pi -e 's/\bPARAMS *\((.*)\);/$1;/'
Remove the remainder manually.
2010-03-11 15:38:19 +01:00
Paolo Bonzini
24ba49c88d eliminate invalid "ptr += (ptr2 - ptr1)"
* lib/savedir.c (savedir): new_name_space and name_space do not point into
the same object, so computing their difference is invalid.  Similarly,
summing the difference to namep is invalid because namep and the result
point into different objects.  Avoid this.
2010-03-05 15:05:35 +01:00
Paolo Bonzini
401d81946e fix for bug 21276
* lib/savedir.c (isdir1): Use realloc instead of calloc.  Remove
dead code.
(savedir): Do not leak name_space if allocation of new_name_space fails.
2010-03-05 15:05:35 +01:00
Jim Meyering
26ad4e6d14 build: avoid warnings in gnulib-supplied regex files
Now that we enable more warnings in lib/, we choose
to avoid some via patches applied by bootstrap, using
files in the gl/ hierarchy.  Other, less-important
warnings are avoided simply by turning off the
-Wold-style-definition option and using a slightly
relaxed set of warnings $(GNULIB_WARN_CFLAGS) in lib/.
* gl/lib/regcomp.c.diff: Avoid warnings.
* gl/lib/regex_internal.c.diff: Likewise.
* gl/lib/regex_internal.h.diff: Likewise.
* gl/lib/regexec.c.diff: Likewise.
* configure.ac (GNULIB_PORTCHECK): Disable only -Wold-style-definition.
* lib/Makefile.am (AM_CFLAGS): Use $(GNULIB_WARN_CFLAGS) rather
than the slightly more strict $(WARN_CFLAGS).
2010-02-03 21:52:30 +01:00
Jim Meyering
967f0d59b6 maint: use regex from gnulib, rather than our bit-rotting one
* bootstrap.conf (gnulib_modules): Add regex.
* configure.ac: Don't use jm_INCLUDED_REGEX.
Update use of cache variable.
* lib/regex.c: Remove file.
* lib/regex.h: Likewise.
* m4/regex.m4: Likewise.
* POTFILES.in: Update to match.
2010-02-03 21:32:57 +01:00
Jim Meyering
9ce8c3516a build: add configure-time --enable-gcc-warnings option; avoid warnings
* bootstrap.conf (gnulib_modules): Add "manywarnings" module.
* configure.ac: Add --enable-gcc-warnings, derived from code in bison.
* src/Makefile.am (AM_CFLAGS): Set to $(WARN_CFLAGS) $(WERROR_CFLAGS)
* lib/Makefile.am (AM_CFLAGS): Likewise, but append.
2010-01-06 10:34:59 +01:00
Jim Meyering
876e90a53e maint: remove {m4,lib}/.gitignore; they were undergoing too much churn
* .gitignore: Ignore all of m4/* except m4/djgpp.m4
and all of lib/* except Makefile.am, savedir.c and savedir.h.
* m4/.gitignore: Remove file.
* lib/.gitignore: Remove file.
2010-01-06 10:34:26 +01:00
Jim Meyering
438dba06da maint: update all FSF copyright year lists to include 2010
Use this command:
git ls-files |grep -vE '^(\..*|COPYING|gnulib)$' |xargs \
env UPDATE_COPYRIGHT_USE_INTERVALS=1 build-aux/update-copyright
2010-01-01 16:20:57 +01:00
Jim Meyering
ecb0e55a4a maint: enable prohibit_have_config_h check
* cfg.mk (local-checks-to-skip): Enable sc_prohibit_have_config_h
* lib/regex.c: Remove useless cpp test of HAVE_CONFIG_H.
* lib/savedir.c: Likewise.
* src/grep.c: Likewise.
* src/kwset.c: Likewise.
* src/search.c: Likewise.
2009-12-04 23:35:23 +01:00
Paolo Bonzini
25625f51d6 fix compilation with included regex
* Makefile.am (libgreputils_a_DEPENDENCIES): New.
2009-12-04 13:47:25 +01:00
Jim Meyering
a26b7e5525 maint: enable makefile @...@ check
* cfg.mk (local-checks-to-skip): Enable sc_makefile_check.
* lib/Makefile.am (libgreputils_a_LIBADD): Use $(...), rather than
anachronistic @...@ notation.
* src/Makefile.am (LDADD): Likewise.
* tests/Makefile.am (AWK): Remove definition.
2009-11-30 16:55:04 +01:00
Jim Meyering
8fadfb0b0e maint: use gnulib's progname module; enable set_program_name check
* bootstrap.conf (gnulib_modules): Add progname.
* src/grep.c: Include "progname.h".
(program_name): Remove declaration.
(main): Call set_program_name.
* cfg.mk (local-checks-to-skip): Add sc_program_name.
2009-11-30 16:55:04 +01:00
Jim Meyering
f6bebd34b6 maint: enable "file system" check
* cfg.mk (local-checks-to-skip): Enable sc_file_system.
* lib/savedir.c (savedir): Tweak spelling.  Remove trailing blanks.
2009-11-30 16:55:04 +01:00