2010-09-16  Jim Meyering  <meyering@redhat.com>

	version 2.7
	* NEWS: Record release date.

2010-09-14  Paolo Bonzini  <bonzini@gnu.org>

	tests: add equiv-classes
	* configure.ac (USE_INCLUDED_REGEX): Add Automake conditional.
	* tests/equiv-classes: New test.
	* tests/Makefile.am (TESTS): Add it.
	(XFAIL_TESTS) [USE_INCLUDED_REGEX]: Mark it as expected failure.

	dfa: fall back to glibc matcher if a MBCSET is found
	This patch enables full support of equivalence classes and multicharacter
	collation symbols.  It can also improve performance problems in some
	cases for multibyte grep.  Both of these changes however depend on the
	glibc version installed in the system.

	For UTF-8 it will trigger only in the presence of MBCSET, e.g. [a-z].
	For other character sets all brackets and `.` as well will trigger it.

	* NEWS: Document this.
	* src/dfa.c (dfaexec): Fall back to glibc for multibyte matches,
	if possible.

	build: update gnulib submodule to latest
	This is done to include commit "regex: Pass the system regex if its only
	problem is 32-bit regoff_t".

	* gnulib: Update to e2b0e1a.

2010-09-12  Jim Meyering  <meyering@redhat.com>

	build: update gnulib submodule to latest

	tests: update init.sh from gnulib
	* tests/init.sh: Update from gnulib.

2010-09-08  Patrick Boyd  <pboyd04@gmail.com>

	dfa: reduce stack usage
	* src/dfa.c (dfaanalyze): Allocate GRPS and LABELS arrays from heap,
	not on the stack.  With this change, grep can now run in these UEFI
	simulators:
	http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=EDK
	http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=EDK2

2010-09-08  Jim Meyering  <meyering@redhat.com>

	tests/portability: avoid spurious failure with OpenBSD's /bin/sh
	* tests/warn-char-classes: Don't use "set -x" here.  It causes
	a spurious test failure on openbsd 4.7 when using its /bin/sh,
	since the command, /bin/sh -xc 'P=1 : 2> err' emits "P=1" into err.
	To enable set -x, run the test with "VERBOSE=yes", e.g.,
	make check -C tests TESTS=warn-char-classes VERBOSE=yes

	build: update gnulib submodule to latest

2010-09-03  Jim Meyering  <meyering@redhat.com>

	tests: remove .sh suffix from remaining test scripts.
	* tests/backref: Rename from backref.sh.
	* tests/bre: Rename from bre.sh.
	* tests/ere: Rename from ere.sh.
	* tests/file: Rename from file.sh.
	* tests/khadafy: Rename from khadafy.sh.
	* tests/options: Rename from options.sh.
	* tests/pcre: Rename from pcre.sh.
	* tests/spencer1: Rename from spencer1.sh.
	* tests/spencer2: Rename from spencer2.sh.
	* tests/status: Rename from status.sh.
	* tests/yesno: Rename from yesno.sh.
	* tests/Makefile.am: Reflect renamings.

	tests: convert remaining tests to use init.sh
	* tests/file.sh: Use init.sh. Use Exit, not exit. Use grep, not ${GREP}.
	* tests/khadafy.sh: Likewise.
	* tests/options.sh: Likewise.
	* tests/spencer1.sh: Likewise.
	* tests/spencer2.sh: Likewise.
	* tests/status.sh: Likewise.
	* tests/spencer1.awk: Use grep, not ${GREP}.
	Don't ignore failure to generate intermediate shell script.
	* tests/Makefile.am (CLEANFILES): Remove altogether, now that
	all tests use init.sh.
	(TESTS_ENVIRONMENT): Don't set GREP.  It's no longer used.

	tests: remove warning.sh
	* tests/warning.sh: Remove file.  All it did was print a warning.
	* tests/Makefile.am (TESTS): Remove warning.sh.

	tests: convert pcre.sh to use init.sh
	* tests/pcre.sh: Use init.sh. Use Exit, not exit. Use grep, not ${GREP}.

	tests: convert bre.sh to use init.sh
	* tests/bre.sh: Use init.sh.
	Use Exit, not exit.
	Use "$abs_top_srcdir/tests/", not "$srcdir/" to specify inputs.
	Source generated bre.script, rather than invoking $SHELL.
	* tests/ere.sh: Likewise.
	* tests/bre.awk: Use grep, not ${GREP}.
	* tests/ere.awk: Likewise.
	* tests/Makefile.am (CLEANFILES): Remove bre.script and ere.script.

	tests: convert to use init.sh
	* tests/yesno.sh: Use init.sh.
	Use Exit, not exit.
	Use grep, not $GREP.
	* tests/backref.sh: Likewise.
	* tests/Makefile.am (CLEANFILES): Remove yesno.txt.

	build: update gnulib submodule to latest

	build: update build/test tools from gnulib
	* bootstrap: Update from gnulib.
	* tests/init.sh: Likewise.

2010-09-01  Jim Meyering  <meyering@redhat.com>

	maint: add lib/version-etc.c to the list in POTFILES.in
	* po/POTFILES.in: Add lib/version-etc.c.

	grep: diagnose and exit-2 for bogus REs like [:space:], [:digit:], etc.
	When I make a mistake like this:
	  grep '[:lower:]' ...
	be it in a script or on the command line, I want to know about
	it as soon as possible.  I don't want grep to print a mere warning
	that it is interpreting this suspicious and almost guaranteed-wrong
	regular expression as a set of just 6 bytes.  And I certainly don't
	want grep to silently do the wrong thing, even if that would be
	officially standards-conforming.  It's obvious that I intended
	[[:lower:]], and I want my error to be diagnosed in a way that is
	most likely to get my attention.  Thus, with this change, grep now
	prints a diagnostic and exits with status 2 the moment it
	encounters an offending [:char_class:] construct.

	This changes the way grep works by default, rather than
	putting this new behavior on an option.  A new option
	would seldom be used in scripts (not portable), and would
	probably be used only rarely by those who need it the most.
	This new functionality provides a valuable safety measure
	and incurs truly negligible risk.

	For strict POSIX compliance, set POSIXLY_CORRECT in
	your environment.  That disables this new feature.

	Revert the changes from commit 2cd3bcea, "grep: add
	--warnings={always,never,auto}.", and then do the following:

	* src/dfasearch.c (dfawarn): Call getenv("POSIXLY_CORRECT") here;
	Remove "warning: " from the diagnostic, now that it's more than
	a warning, and exit with status 2.
	* NEWS (New features): Describe the new semantics.
	* tests/warn-char-classes: Adjust one test to accommodate this change.
	* doc/grep.texi (Character Classes and Bracket Expressions): Document.
	(Environment Variables): Cross-reference it.
	Remove reference to obsolete getopt illegal vs. invalid difference.
	Thanks to Paul Eggert for suggestions and an initial prod.

2010-08-30  Jim Meyering  <meyering@redhat.com>

	maint: use gnulib's standard --version-printing code
	This includes author names and keeps the copyright year up to date.
	* bootstrap.conf (gnulib_modules): Add propername and version-etc-fsf.
	* src/main.c (AUTHORS): Define.
	(main): Use version_etc, rather than hard-coding the copyright text.
	Prompted by a patch from Paolo Bonzini.

2010-08-27  Paolo Bonzini  <bonzini@gnu.org>

	dfa: warn on [:space:] and similar
	* src/dfa.c (parse_bracket_exp): Warn on regular expressions such as
	[:space:].
	* src/dfa.h (dfawarn): New prototype.
	* src/dfasearch.c (dfawarn): New.
	* NEWS: Document.

	tests: add test for warnings
	* tests/Makefile.am (TESTS): Add warn-char-class.
	* tests/warn-char-class: New.

	grep: add --warnings={always,never,auto}.
	* src/grep.h (no_warnings): New declaration.
	* src/main.c (no_warnings): New.
	(WARNINGS_OPTION): Add to enum.
	(main): Add --warnings.  Handle color_option == 2 together with it.

	tests: add failing test for grep from a directory
	* tests/Makefile.am (TESTS, XFAIL_TESTS): Add grep-dir.
	* tests/grep-dir: New.

	tests: add test for previous commit
	* tests/Makefile.am (TESTS): Add grep-dev-null.
	* tests/grep-dev-null: New.

	search: fix "grep -Fif /dev/null"
	* bootstrap.conf: Include gnulib module minmax.
	* src/searchutils.c (mbtolower): Handle *N == 0 case.
	* src/system.h: Include minmax.h from gnulib.

2010-08-27  Adam Katz  <savannah@kopis.com>

	Remove declaration after statement in dfa.c
	* dfa.c (dfaexec): Declare saved_end at the beginning of the function.

2010-08-14  Jim Meyering  <meyering@redhat.com>

	make --include=FILE work once again
	The semantics of excluded_file_name changed (when operating on
	an "included" file name list).
	* src/main.c (main): Adjust for changed semantics of excluded_file_name
	simply by removing a negation.
	* NEWS (Bug fixes): Mention this fix.
	* tests/include-exclude: Add a test for this.
	Reported by Joe Perches in http://savannah.gnu.org/bugs/?29876.

2010-07-16  Paolo Bonzini  <bonzini@gnu.org>

	doc: document \s and \S
	* doc/grep.texi (The Backslash Character and Special Expressions):
	Document \s and \S escapes.

2010-05-29  Karl Berry  <karl@gnu.org>

	doc: discuss matches that span two or more lines
	* doc/grep.texi (Usage): Discuss matching across lines.
	(Character Classes and Bracket Expressions) <[:space:]>: refer to it.

2010-05-26  Jim Meyering  <meyering@redhat.com>

	build: use latest gettext: 0.18
	* configure.ac: Use gettext-0.18.
	* bootstrap.conf (gnulib_modules): Use gettext-h, not gettext.
	since the latter drags in a depedency on gettext 0.18.
	Suggested by Bruno Haible.

	maint: update helper scripts from gnulib
	* tests/init.sh: Update from gnulib.
	* bootstrap: Likewise.

	build: update gnulib submodule to latest

	maint: don't emit an extra newline in each of two diagnostics
	* src/main.c (context_length_arg, grepdir): Remove a stray \n in
	each of two diagnostics.

2010-05-24  Bruno Haible  <bruno@clisp.org>

	search: Avoid out-of-bounds access.
	* src/dfasearch.c (EGexecute): Avoid access beyond end of buffer
	that could happen if start != beg - buf.

2010-05-23  Aharon Robbins  <arnold@skeeve.com>

	dfa: fix signedness warnings
	* src/dfa.c (dfaexec): Cast p when passing it to prepare_wc_buf.

2010-05-09  Jim Meyering  <meyering@redhat.com>

	tests: update init.sh
	* tests/init.sh: Update from gnulib.

	tests: normalize init.sh-sourcing code
	* tests/backref-multibyte-slow: Use one-line idiom.
	* tests/backref-word: Likewise.
	* tests/case-fold-backref: Likewise.
	* tests/case-fold-backslash-w: Likewise.
	* tests/case-fold-char-class: Likewise.
	* tests/case-fold-char-range: Likewise.
	* tests/case-fold-char-type: Likewise.
	* tests/char-class-multibyte: Likewise.
	* tests/dfaexec-multibyte: Likewise.
	* tests/empty: Likewise.
	* tests/euc-mb: Likewise.
	* tests/fedora: Likewise.
	* tests/fgrep-infloop: Likewise.
	* tests/fmbtest: Likewise.
	* tests/foad1: Likewise.
	* tests/ignore-mmap: Likewise.
	* tests/include-exclude: Likewise.
	* tests/max-count-vs-context: Likewise.
	* tests/pcre-z: Likewise.
	* tests/prefix-of-multibyte: Likewise.
	* tests/reversed-range-endpoints: Likewise.
	* tests/sjis-mb: Likewise.
	* tests/spencer1-locale: Likewise.
	* tests/word-delim-multibyte: Likewise.
	* tests/word-multi-file: Likewise.

	tests: update help-version
	* tests/help-version: Update from coreutils.

2010-05-06  Jim Meyering  <meyering@redhat.com>

	tests: enable glibc's malloc-perturbing option
	* tests/Makefile.am (MALLOC_PERTURB_): Define, in case it's not already
	set in your environment.
	(TESTS_ENVIRONMENT): Propagate MALLOC_PERTURB_ setting to test scripts.

2010-05-06  Paolo Bonzini  <bonzini@gnu.org>

	dfa: speed up [[:digit:]] and [[:xdigit:]]
	There's no "multibyte pain" in these two classes, since POSIX
	and ISO C99 mandate their contents.

	Time for "./grep -x '[[:digit:]]' /usr/share/dict/linux.words"
	Before: 1.5s, after: 0.07s.  (sed manages only 0.5s).

	* src/dfa.c (predicates): Declare struct dfa_ctype separately
	from definition.  Add sb_only.
	(find_pred): Return const struct dfa_ctype *.
	(parse_bracket_exp): Return const struct dfa_ctype *.  Do
	not fill MBCSET for sb_only character types.

2010-05-05  Jim Meyering  <meyering@redhat.com>

	tests: readability: use awk rather than obfuscated sed
	* tests/backref-multibyte-slow: Generate input using an awk for-loop
	rather than expensive and harder-to-read sed pipes.
	Remove stray "set -x" and "wc -l in".

	dfa: avoid segfault when processing an invalid multi-byte sequence
	* src/dfa.c (dfaexec): Handle the cases in which mbrtowc returns
	(size_t)-1 or (size_t)-2, rather than setting mblen_buf[i] to an
	outrageously large value.

2010-05-05  Paolo Bonzini  <bonzini@gnu.org>

	grep: remove redundant syntax bit
	* grep.c (Gcompile): Remove RE_HAT_LISTS_NOT_NEWLINE.

	tests: add test for newly-fixed performance problem
	* tests/backref-multibyte-slow: New.
	* tests/Makefile.am: Add it.

	dfa: convert to wide character line-by-line
	This provides a nice speedup for -m in general, but especially
	it avoids quadratic complexity in case we have to go to glibc.

	* NEWS: Document change.
	* src/dfa.c (prepare_wc_buf): Extract out of dfaexec.  Convert
	only up to the next newline.
	(dfaexec): Exit multibyte processing loop if past buf_end.
	Call prepare_wc_buf again after processing a newline.

2010-05-01  Jim Meyering  <meyering@redhat.com>

	maint: remove useless #if HAVE_STDLIB_H
	* src/mbsupport.h: Don't test HAVE_STDLIB_H.

2010-04-20  Jim Meyering  <meyering@redhat.com>

	dfa: don't #ifdef-out member declarations
	* src/dfa.c (struct dfa): Remove "#if MBS_SUPPORT" guard that made
	several member declarations conditional on this cpp definition.
	(token): Likewise.
	Reported by Anders Wallin.

	tests: ensure that the --mmap option is ignored
	* tests/ignore-mmap: New file.
	* tests/Makefile.am (TESTS): Add it.
	Reported by Jaroslav Škarvada in <http://savannah.gnu.org/bugs/?29614>

2010-04-20  Paolo Bonzini  <bonzini@gnu.org>

	dfa: honor RE_DOT_NEWLINE and RE_DOT_NOT_NULL in UTF-8 period optimization
	* src/dfa.c (add_utf8_anychar): Check for RE_DOT_NEWLINE and
	RE_DOT_NOT_NULL.

	grep: fix --mmap not being ignored
	* NEWS: Document bugfix.
	* main.c (main): Ignore MMAP_OPTION.

2010-04-19  Jim Meyering  <meyering@redhat.com>

	maint: avoid syntax-check failure due to indentation via TABs
	* src/dfa.c (atom): Expand TABs in indentation.

	build: update gnulib submodule to latest

	maint: restrict scope of two globals to dfasearch.c
	* src/dfasearch.c (patterns, pcount): Declare these file-scoped
	globals to be static.

2010-04-19  Paolo Bonzini  <bonzini@gnu.org>

	dfa: optimize UTF-8 period
	* NEWS: Document improvement.
	* src/dfa.c (struct dfa): Add utf8_anychar_classes.
	(add_utf8_anychar): New.
	(atom): Simplify if/else nesting.  Call add_utf8_anychar for ANYCHAR
	in UTF-8 locales.
	(dfaoptimize): Abort on ANYCHAR.

	dfa: drop ORTOP
	* src/dfa.c (token, prtok, addtok_mb, nsubtoks, dfaanalyze, dfamust):
	Remove ORTOP.
	(regexp): Remove parameter, always add OR at the end, adjust callers.
	(atom): Adjust caller.
	(dfaparse): Adjust caller.  Always add OR at the end.

	dfa: fix {0,0}
	* NEWS: Document change.
	* src/dfa.c (struct dfa): Remove "broken" field.
	(lex): Do not set it.
	(closure): On {0,0}, backup and lex another closure without
	adding a CAT.
	(dfabroken): Remove.
	* src/dfa.h (dfabroken): Remove.
	* tests/spencer1.tests: Add testcases for {m,n}.

	dfa: simplify dfainit
	* src/dfa.c (dfainit): Use memset.

2010-04-17  Jim Meyering  <meyering@redhat.com>

	doc: fix a nit in HACKING
	* HACKING: Correct size of .git/ dir: 9MB, not 30MB.

	tests: add an expected-to-fail test using \< in a multi-byte locale
	* tests/word-delim-multibyte: New test.  Currently failing.
	* tests/Makefile.am (TESTS): Add it.
	(XFAIL_TESTS): Define, temporarily.
	Reported by Jaroslav Škarvada in http://savannah.gnu.org/bugs/?29537.

2010-04-17  Paolo Bonzini  <bonzini@gnu.org>

	test: cover just-fixed bug
	* tests/empty: Test -Fw too.

	grep: fix matching the empty string with grep -Fw
	* NEWS: Document fix.
	* src/kwsearch.c (Fexecute): The empty string is a valid match if it is
	a whole word.

2010-04-16  Jim Meyering  <meyering@redhat.com>

	maint: update init.sh and HACKING
	* HACKING: Sync from coreutils.
	* tests/init.sh: Update from gnulib.

2010-04-13  Jim Meyering  <meyering@redhat.com>

	build: update gnulib submodule to latest; adapt
	* COPYING: Remove empty line.
	* README: Likewise.
	* doc/fdl.texi: Likewise.
	* tests/backref-word: Likewise.

2010-04-12  Stefano Lattarini  <stefano.lattarini@gmail.com>

	tests: accept the Debian timeout program
	* tests/init.cfg: test timeout with `timeout 10s true'

2010-04-08  Jim Meyering  <meyering@redhat.com>

	dfa: convert "cannot happen" code/comment to use assert
	* src/dfa.c (dfamust): There were numerous "cannot happen" comments,
	some associated with "if (expr) goto done;".  Replace each with an
	equivalent "assert (!expr);".

	build: use gnulib's isblank module
	* bootstrap.conf (gnulib_modules): Use gnulib's isblank module,
	now that we rely on the function by that name.

	maint: undo TAB-conversion change to gl/lib/*.c.diff
	This fixes a bootstrap failure due to the patches not applying.
	* .x-sc_prohibit_tab_based_indentation: Add ^gl/lib/.*\.c\.diff$
	* gl/lib/regcomp.c.diff: Revert today's TAB->space change.
	* gl/lib/regex_internal.c.diff: Likewise.
	* gl/lib/regexec.c.diff: Likewise.

2010-04-08  Arnold D. Robbins  <arnold@skeeve.com>

	dfa: fix declaration of dfabroken in dfa.h
	* dfa.h (dfabroken) [GAWK]: Fix declaration to match that in dfa.c.

2010-04-08  Jim Meyering  <meyering@redhat.com>

	maint: add syntax-check rule to enforce the new no-leading-TABs policy
	* cfg.mk (sc_prohibit_tab_based_indentation): New rule, from coreutils.
	(sc_prohibit_emacs__indent_tabs_mode__setting): Likewise.
	(old_NEWS_hash): Update.
	* .x-sc_prohibit_tab_based_indentation: List exempt files.

	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 : $_'

	build: include cfg.mk in the distribution tarball
	* Makefile.am (EXTRA_DIST): Add cfg.mk.

	maint: Makefile.am tweak  (no semantic change)
	* Makefile.am (EXTRA_DIST): List one per line.  Sort.

	build: include cfg.mk in the distribution tarball
	* Makefile.am (EXTRA_DIST): Add cfg.mk.

	dfa: move definition of __attribute__ back into dfa.h
	* src/dfa.c (__attribute__): Move definition back to...
	* src/dfa.h: ... this file.  It is essential for non-gcc compilers.
	Reported by Arnold Robbins.

2010-04-07  Arnold D. Robbins  <arnold@skeeve.com>

	dfa: move internals from dfa.h to dfa.c
	* src/dfa.h: Move internals into dfa.c.
	* src/dfa.c: The dfa internals are now totally local to this file.
	(dfaalloc, dfamusts, dfabroken): New functions to access features.
	* src/dfasearch.c (dfa): Change this global variable from struct to pointer.
	Adapt to that change, and use new functions, dfamusts and dfaalloc.

2010-04-07  Jim Meyering  <meyering@redhat.com>

	mbtolower: avoid potential NULL-dereference
	* src/searchutils.c: Include <assert.h>.
	(mbtolower): Assert that 0 < *n, to avoid possibility of NULL-deref.
	Remove dead increment.

	maint: tell git to ignore more build products
	* .gitignore: Also ignore results of "make ID" and "make tags".

	build: update gnulib submodule to latest

	tests: use init.sh consistently
	* tests/euc-mb: Call "path_prepend_ ." on a line by itself,
	and with a comment.  This makes it so all of the srcdir/init.sh
	lines are consistent, project-wide, and so that the addition of "."
	to PATH for this test is properly documented.
	* tests/sjis-mb: Likewise.

	maint: avoid new syntax-check failure, ...
	...now that the sole use of xmalloc no longer matches the
	regular expression used by the syntax-check rule.
	* .x-sc_prohibit_xalloc_without_use: Exempt src/kwset.c.

	grep: make kwset's obstack use xmalloc, not malloc
	This insidious bug could make grep fail to diagnose a failed malloc,
	and then proceed to dereference the resulting NULL pointer.
	Note that this bug was unlikely ever to cause real trouble; without
	the fix, grep would segfault upon OOM, now it exits with a diagnostic.
	* src/kwset.c (malloc) [GREP]: Define without the "(s)" macro
	parameter, so that unadorned uses of malloc are also mapped to xmalloc.
	One such use is in the expansion of obstack_init.
	Report and patch by Nelson H. F. Beebe, in
	http://thread.gmane.org/gmane.comp.gnu.grep.bugs/2995

	tests: improve help-version (sync from gzip's version)
	* tests/help-version: Cross-check $VERSION and --version output.
	* tests/Makefile.am (TESTS_ENVIRONMENT): Export VERSION=$(VERSION).

2010-04-06  Jim Meyering  <meyering@redhat.com>

	doc: update THANKS
	* THANKS: Update.

2010-04-06  Aharon Robbins  <arnold@skeeve.com>

	build: avoid conflict with WCHAR definition from Cygwin's <windows.h>
	* src/dfa.h (enum token): Remove the definition from this file.
	Replace with a declaration and typedef.  Moved to ...
	* src/dfa.c (enum token): ... here.
	Reported by Corinna Vinschen.

2010-04-06  Jim Meyering  <meyering@redhat.com>

	doc: add HACKING
	* HACKING: New file.  Copied from coreutils, with s/coreutils/grep/
	and a few minor edits.

2010-04-05  Jim Meyering  <meyering@redhat.com>

	tests: pull fixed init.sh from gnulib
	* tests/init.sh: Update from gnulib.

	maint: fix new argmatch-related syntax-check failures
	* configure.ac (ARGMATCH_DIE): Use usage(EXIT_FAILURE), not exit(1).
	* po/POTFILES.in: Add lib/argmatch.c.

	maint: update cfg.mk to work with gnulib's newer "make syntax-check"
	* cfg.mk: Update to use new _sc_search_regexp interface.  Run this:
	perl -pi -e 's/\b_prohibit_regexp\b/_sc_search_regexp/;'
	-e 's/\bmsg=/halt=/; s/\bre=/prohibit=/;' cfg.mk
	and then adjust backslashes so they still line up.

	maint: update tests/init.sh from gnulib
	This ensures that the explanation for any skipped or failed test
	is printed on stderr, not buried in each .log file.
	* tests/init.sh: Update from gnulib.
	* tests/init.cfg (stderr_fileno_): Define to 9, to match the
	literal 2>&9 in tests/Makefile.am

	build: update gnulib submodule to latest

2010-04-04  Jim Meyering  <meyering@redhat.com>

	maint: use argmatch, for better --directories=INVAL diagnostics
	Before, you'd see this:
	  grep: unknown directories method

	Now, you'll see this:
	  grep: invalid argument `INVAL' for `--directories'
	  Valid arguments are:
	    - `read'
	    - `recurse'
	    - `skip'
	  Usage: src/grep [OPTION]... PATTERN [FILE]...
	  Try `src/grep --help' for more information.

	* bootstrap.conf: Add argmatch.
	* configure.ac: Define ARGMATCH_DIE and ARGMATCH_DIE_DECL.
	* src/main.c (directories_type): Define.
	(directories_args, directories_types) Define.
	All of the above so we can...
	(main): Use XARGMATCH.
	(usage): Declare extern, now that argmatch calls it via ARGMATCH_DIE.

	dfa.c: const correctness; and remove useless casts of realloc and malloc
	* src/dfa.c (icatalloc, icpyalloc, istrstr, enlist): As above.
	(inboth, dfamust, comsubs): Likewise.

	dfa.c: use a better (unsigned) type for an index: int->unsigned int
	* src/dfa.c (dfaexec): Use "unsigned int" for a logically unsigned index.

	maint: style: use sizeof VAR, rather than sizeof TYPE, where possible
	* src/dfa.c (copyset, zeroset): Prefer sizeof EXPR, over sizeof TYPE,
	for improved readability/maintainability.
	(equal, parse_bracket_exp, addtok_wc, dfaparse, dfaexec): Likewise.

2010-04-02  Jim Meyering  <meyering@redhat.com>

	dfa.c: use a better (unsigned) type for an index: int->size_t
	* src/dfa.c (parse_bracket_exp): Use size_t as type of index, not int.

	maint: const-correctness
	* src/dfa.c (tstbit, copyset, equal, charclass_index): Declare read-only
	"charclass" parameters to be "const".  No semantic change.

	maint: include <wchar.h> and <wctype.h> unconditionally
	* src/main.c: Include <wchar.h> and <wctype.h> unconditionally.
	Their presence/usefulness are assured by gnulib.
	* src/dfa.c: Likewise.
	* src/search.h: Likewise.

	maint: MBS_SUPPORT: define to 0/1, not undef/1
	Prepare to remove many of these #ifdefs.
	* src/mbsupport.h (MBS_SUPPORT): Define to 0/1, not undef/1.
	Change each "#ifdef MBS_SUPPORT" to "#if MBS_SUPPORT".  Use this:
	perl -pi -e 's/ifdef (MBS_SUPPORT)/if $1/' $(g grep -l ifdef.MBS_SUPPO)
	* src/dfa.c: s/#ifdef MBS_SUPPORT/#if MBS_SUPPORT/
	* src/dfa.h: Likewise.
	* src/dfasearch.c: Likewise.
	* src/kwsearch.c: Likewise.
	* src/main.c: Likewise.
	* src/search.h: Likewise.
	* src/searchutils.c: Likewise.

	maint: use STREQ in place of strcmp
	perl -pi -e 's/\bstrcmp *\((.*?)\) == 0/STREQ ($1)/' src/main.c
	perl -pi -e 's/\bstrcmp *\((.*?)\) != 0/!STREQ ($1)/' src/main.c

	* src/dfa.c (STREQ): Define.
	Use it instead of strcmp.
	* src/main.c (STREQ): Likewise.
	* cfg.mk (local-checks-to-skip): Remove sc_prohibit_strcmp,
	to enable the strcmp-prohibition.

	maint: enable the useless_cpp_parens syntax check
	* cfg.mk (local-checks-to-skip): Remove sc_useless_cpp_parens.
	* src/main.c (devices, fillbuf, exit_on_match): Remove useless parens.
	(print_line_head, grepfile, set_limits, main): Likewise.
	* src/vms_fab.h: Likewise.
	* vms/config_vms.h: Likewise.
	* src/mbsupport.h: Likewise.

	cleanup and improvement: parse command line arguments consistently
	* src/main.c: Include c-ctype.h, for this:
	(prepend_args): Use c_isspace, not ISSPACE.
	This is important so that we parse arguments consistently,
	and independently of the current locale.
	* bootstrap.conf (gnulib_modules): Add c-ctype.
	* src/system.h: Remove IS* definitions here, too.
	* src/dfasearch.c (WCHAR): Use isalnum, not ISALNUM.
	* src/kwsearch.c (WCHAR): Likewise.
	* src/searchutils.c (kwsinit): Use tolower, not TOLOWER.

	cleanup: rely on gnulib's ctype.h functions; remove IS* macros and is_*
	* src/dfa.c (setbit_case_fold, prednames): Use official names.
	(IS_WORD_CONSTITUENT, lex): Likewise.
	(ISALNUM, ISALPHA, ISCNTRL, ISDIGIT, ISGRAPH): Remove definitions.
	(ISLOWER, ISPRINT, ISPUNCT, ISSPACE, ISUPPER, ISXDIGIT): Likewise.
	(is_alnum, is_alpha, is_blank, is_cntrl, is_digit, is_graph): Likewise.
	(is_lower, is_print, is_punct, is_space, is_upper, is_xdigit): Likewise.
	(isgraph): Likewise.

	build: update gnulib submodule to latest, and adjust
	* src/main.c (parse_grep_colors): Adjust diagnostics not to trigger
	the sc_error_message_period and sc_error_message_uppercase
	syntax-check rules.

	maint: remove all VMS-related code
	* configure.ac (AC_CONFIG_FILES): Remove vms/Makefile
	* Makefile.am (SUBDIRS): Remove vms.
	* src/Makefile.am (EXTRA_DIST): Remove vms_fab.c and vms_fab.h.
	* src/vms_fab.c, src/vms_fab.h, vms/make.com: Remove files.
	* vms/Makefile.am, vms/README, vms/config_vms.h: Likewise.

	post-release administrivia
	* NEWS: Add header line for next release.
	* .prev-version: Record previous version.
	* cfg.mk (old_NEWS_hash): Auto-update.

	version 2.6.3
	* NEWS: Record release date.

	grep: avoid used-undefined error with truncated multibyte input
	* src/dfa.c (addtok_wc): Don't use buf[0] (it's undefined) when
	wcrtomb returns <= 0.

	MBS_SUPPORT-removal: * src/dfa.c (dfastate):

2010-04-01  Jim Meyering  <meyering@redhat.com>

	maint: avoid unnecessary 2nd getenv("TERM")
	* src/main.c (main): Don't call getenv("TERM") twice -- in the same
	expression, even.

	tests: remove all unportable uses of echo
	* src/main.c: Use printf rather than echo -ne in a comment.
	* tests/fedora: Use printf (not echo) also in ok/fail functions.
	* cfg.mk (sc_prohibit_echo_minus_en): New rule, to prohibit
	any future introduction.

	tests: add explicit requirement for en_US.UTF-8
	* tests/char-class-multibyte: Use require_en_utf8_locale_,
	rather than open-coding it.
	* tests/prefix-of-multibyte: Require the locale explicitly.
	* tests/fgrep-infloop: Likewise.
	This fixes test failures that would arise on systems without
	that particular locale.  Reported by Ludovic Courtès.

	tests: new function, to require an en_US UTF8 locale
	* tests/init.cfg (require_en_utf8_locale_): New function.

	tests: use printf, not echo -n, echo -e, or any combination
	* tests/fedora: Using printf is more portable.

	grep: remove unnecessary code
	* src/main.c (print_line_middle): Now that we use RE_ICASE
	(enabled in commit 70e23616, "dfa: rewrite handling of multibyte
	case_fold lexing"), this case-conversion code is useless and wasteful.
	Remove it.

	doc: fix typo: s/AM_V_AT/AM_V_at/
	* doc/Makefile.am (egrep.1 fgrep.1): The former has case consistent
	with its sister variable, AM_V_GEN, but the latter is the one that
	actually works.

	doc: generated files are best made read-only, ...
	...to minimize risk of accidentally modifying the generated file
	rather than its template.  These are tiny, so no risk, but it's
	a good to be consistent, so generated files are easier to spot.
	* doc/Makefile.am (egrep.1 fgrep.1): When generating these files,
	ensure that they too are created read-only.

	doc: generate grep.1 from template
	* doc/Makefile.am (grep.1): New rule.
	(CLEANFILES): Add grep.1 to the list.
	* .gitignore: Add /doc/grep.1
	* doc/grep.in.1: Replace hard-coded "2.5.1-cvs" with @VERSION@.
	Update copyright year list.
	Omit the line-splitting \(co directive so that update-copyright
	will perform future updates automatically.
	Egmont Koblinger reported the outdated version string
	and copyright year list in the man page:
	http://savannah.gnu.org/bugs/?29390

	doc: prepare to generate grep.1
	* doc/grep.1: Rename to...
	* doc/grep.in.1: ...this.

2010-03-31  Eric Blake  <eblake@redhat.com>

	build: avoid another warning
	Noticed on cygwin:
	get-mb-cur-max.c: In function 'main':
	get-mb-cur-max.c:27: error: unused parameter 'argc' [-Wunused-parameter]

	* tests/get-mb-cur-max.c (main): Use argc.

2010-03-31  Paolo Bonzini  <bonzini@gnu.org>

	tests: fix on systems with broken sh
	* tests/Makefile.am (TESTS_ENVIRONMENT): Adjust coreutils remnants.
	* tests/bre.sh: Invoke script with $SHELL if defined.
	* tests/ere.sh: Likewise.
	* tests/spencer1-locale: Likewise.
	* tests/spencer1.sh: Likewise.

	tests: improve empty test
	* tests/empty: Add more tests, note expected failure.

	tests: improve empty test with respect to locales
	* tests/empty: Add tests for multiple locales.

	grep: fix grep -F against empty string
	* src/searchutils.c (is_mb_middle): Do not return true for empty matches
	when p == buf.

	tests: rename empty.sh to empty
	* tests/empty.sh: Rename to...
	* tests/empty: ... this.
	* tests/Makefile.am (TESTS): Adjust.

	tests: convert empty.sh to new style
	* tests/empty.sh: Convert to init.sh, add 10-second timeout.

	tests: use get-mb-cur-max in char-class-multibyte
	* tests/char-class-multibyte: Use get-mb-cur-max to detect UTF-8 support.
	Rewrite previous locale detection code as a grep test.

	tests: fix -Wformat failure
	* tests/get-mb-cur-max (main): Cast MB_CUR_MAX to int.

2010-03-31  Jim Meyering  <meyering@redhat.com>

	doc: add a "Reply-To" to the suggested announcement mail header
	* README-release: Add "Reply-To" with the list address,
	to minimize risk of replies to the other announcement recipients.
	Suggestion from Eric Blake.

2010-03-30  Jim Meyering  <meyering@redhat.com>

	build: avoid compiler warning when building test program
	* tests/Makefile.am (AM_CPPFLAGS, AM_CFLAGS, AM_LDFLAGS): Define,
	so that all the usual C compile-and-link machinery comes into play.
	* tests/get-mb-cur-max.c: Include "progname.h".
	Remove unnecessary inclusion of <ctype.h>.
	Mike Frysinger reported the "implicit decl of set_program_name" warning.

	build: detect PCRE support also when <pcre/pcre.h> is the header
	* m4/pcre.m4: Also check for <pcre/pcre.h>.
	* src/pcresearch.c: Include <pcre/pcre.h>, if needed.
	Guard inclusions with HAVE_PCRE_H and HAVE_PCRE_PCRE_H, not HAVE_LIBPCRE.
	* NEWS (Bug fixes): Mention it.
	Dmitry V. Levin reported that PCRE support was not detected
	on systems with <pcre.h> not in the default include path.

2010-03-29  Jim Meyering  <meyering@redhat.com>

	post-release administrivia
	* NEWS: Add header line for next release.
	* .prev-version: Record previous version.
	* cfg.mk (old_NEWS_hash): Auto-update.

	version 2.6.2
	* NEWS: Record release date.

2010-03-29  Eric Blake  <eblake@redhat.com>

	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.

	maint: ignore new test executable
	* .gitignore: Enhance.

2010-03-29  Jim Meyering  <meyering@redhat.com>

	doc: consolidate redundant-looking entries
	* NEWS: Consolidate the two --include/exclude-related entries.
	Suggested by Eric Blake.

2010-03-29  Paolo Bonzini  <bonzini@gnu.org>

	tests: use $(...) consistently
	* tests/backref.sh: Use `...' instead of ``...'' in comments.
	* tests/bre.awk: Use $(...) instead of `...`.
	* tests/ere.awk: Use $(...) instead of `...`.
	* tests/euc-mb: Use $(...) instead of `...`.
	* tests/fmbtest: Use $(...) instead of `...`.
	* tests/foad1: Use $(...) instead of `...`.
	* tests/pcre-z: Use $(...) instead of `...`.  Quote output of grep.
	* tests/spencer1-locale.awk: Use $(...) instead of `...`.
	* tests/spencer1.awk: Use $(...) instead of `...`.
	* tests/yesno.sh: Use $(...) instead of `...`.

2010-03-29  Jim Meyering  <meyering@redhat.com>

	build: make doc/Makefile.am cleaner and more robust
	* doc/Makefile.am (egrep.1 fgrep.1): Generate robustly, i.e.,
	do not redirect directly to $@.
	Use $(AM_V_GEN).
	Do not distribute intermediate files like fgrep.man and egrep.man.
	Likewise, do not use them to generate their %.1 images.
	Instead, generate the .1 files directly.

2010-03-29  Paolo Bonzini  <bonzini@gnu.org>

	tests: add program to detect locales
	* tests/Makefile.am (check_PROGRAMS): Add get-mb-cur-max.
	* tests/get-mb-cur-max.c: New.
	* tests/euc-mb: Use it.  Fail if the former detection test fails.
	* tests/sjis-mb: Use it.  Fail if the former detection test fails.  Expand
	comments.

	tests: add tests for SJIS character sets
	The attached test will be skipped unless (on a glibc system) you run
	something like

	  mkdir /usr/lib/locale/ja_JP.SHIFT_JIS
	  zcat /usr/share/i18n/charmaps/SHIFT_JIS.gz | \
	    localedef \
	      -f - \
	      -i /usr/share/i18n/locales/ja_JP \
	      /usr/lib/locale/ja_JP.SHIFT_JIS

	* tests/Makefile.am: Add sjis-mb.
	* tests/sjis-mb: New.

	grep -F: fix a bug with SJIS character sets
	Commit db9d6 would erroneously skip matches in SJIS character sets.  In
	this character set low bytes (i.e. ASCII bytes) are also valid second
	bytes in a double-byte character, so you have to continue looking for
	a match, even if you match in the middle of a double-byte character.

	* src/kwsearch.c: Ensure that beg is advanced by at least one byte,
	but do not fail immediately after matching in the middle of a double-byte
	character.

2010-03-29  Bruno Haible  <bruno@clisp.org>

	build: update after change in gnulib's lib-ignore module
	* src/Makefile.am (AM_LDFLAGS): Define.  Use gnulib's new
	$(IGNORE_UNUSED_LIBRARIES_CFLAGS).

2010-03-29  Jim Meyering  <meyering@redhat.com>

	tests: disable new texinfo-acronym syntax-check from gnulib
	* cfg.mk (local-checks-to-skip): Add new sc_texinfo_acronym, to skip it.

2010-03-28  Norihiro Tanaka  <noritnk@kcn.ne.jp>

	tests: exercise fix for improper match of incomplete MB char prefix
	* tests/prefix-of-multibyte: New file.
	* tests/Makefile.am (TESTS): Add it.

2010-03-28  Jim Meyering  <meyering@redhat.com>

	grep -F: fix a multi-byte erroneous-match-in-middle bug
	Just as Perl prints nothing in this case,
	  printf '\357\274\241\n' | perl -CIO -lne '/\357/ and print'

	grep should also print nothing when used as follows.
	However, these would mistakenly match with grep prior to 2.6.2:
	  printf '\357\274\241\n' | LC_ALL=en_US.UTF-8 src/grep -F $'\357'
	  printf '\357\274\241\n' | LC_ALL=en_US.UTF-8 src/grep -F $'\357\274'

	* src/searchutils.c (is_mb_middle): New parameter: the length of the
	match, in bytes, as determined by kwsexec.  Use this to detect when
	the nominal match found by kwsexec must be skipped because it is for
	an incomplete multi-byte character that is a prefix of a character
	in the input.
	* src/dfasearch.c (EGexecute): Update caller.
	* src/kwsearch.c (Fexecute): Likewise.
	* src/search.h: Update prototype.
	* NEWS (Bug fixes): Mention it.
	Report and analysis by Norihiro Tanaka.

2010-03-28  Norihiro Tanaka  <noritnk@kcn.ne.jp>

	tests: add tests for the fgrep-infloop bug
	* tests/init.cfg (require_timeout_): New function.
	* tests/fgrep-infloop: New file.  Test for the above fix.
	* tests/Makefile.am (TESTS): Add it.

2010-03-28  Jim Meyering  <meyering@redhat.com>

	grep -F: avoid infinite loop when searching for incomplete MB character
	Searching for an incomplete non-prefix of a multi-byte character
	should find no match.

	  Just as these print nothing,
	    printf '\357\274\241\357\274\241\n' \
[--snip--]
