Deleted Added
full compact
ChangeLog (126432) ChangeLog (131554)
12002-03-26 Bernhard Rosenkraenzer <bero@redhat.com>
2 * src/grep.c: Don't fail if we don't have an stdout fd and -q
3 is used (happens e.g. on calls from hotplug scripts)
4 * src/grep.c: Don't hang forever if fed with an empty string to
5 grep for and --color enabled
6 * src/grep.c: Fix infinite loop on
7 echo "1 one" | grep -E "[0-9]*" -o
8 echo "1 one" | grep -E "[0-9]*" --color
9 * po/*: Sync wiith translation project
10 * src/grep.c, src/Makefile.am, configure.in: Add patch from
11 Paul Eggert <eggert@twinsun.com> to comply with ridiculous
12 guidelines (don't act differently if invoked as egrep or fgrep)
13 * configure.in: Bump version number, require a recent autoconf
14
152002-03-14 Bernhard Rosenkraenzer <bero@redhat.com>
16 * src/Makefile.am, po/Makefile.in.in: Support DESTDIR properly
17 * tests/bre.tests: Add fix from
18 Peter Breitenlohner <peb@mppmu.mpg.de>
19
202002-03-13 Bernhard Rosenkraenzer <bero@redhat.com>
21 * configure.in, m4/regex.m4, m4/malloc.m4, m4/realloc.m4:
22 Don't set LIBOBJS directly, autoconf 2.53 doesn't like it
23 * intl/*: Sync with gettext 0.11
24 * po/*: Sync with translation project
25 * configure.in, src/Makefile.am: Don't duplicate code - make
26 egrep and fgrep links to grep and set matcher based on
27 application name, suggestion from
28 Guillaume Cottenceau <gc@mandrakesoft.com>
29 * src/grep.c: (prline) Add fix for -i --color from
30 Jim Meyering <meyering@lucent.com>
31 * configure.in: Version 2.5; release
32
332002-01-23 Bernhard Rosenkraenzer <bero@redhat.com>
34 * configure.in: Version 2.5g
35 * Makefile.cvs, grep.spec: Add packaging tools
36 Merge djgpp changes from Andrew Cottrell <anddjgpp@ihug.coml.au>:
37 * src/grep.c: Added conditional compilation for DJGPP
38 * djgpp: remove directory as it is no longer required with DJGPP 2.03
39 (or 2.04 when released)
40 * README.DOS: Moved djgpp/readme to readme.dos
41 * PATCHES.AC, PATCHES.AM: delete files - redundant
42 * configure.in, Makefile.am: remove djgpp directory from list
43
442002-01-22 Bernhard Rosenkraenzer <bero@redhat.com>
45 * doc/grep.texi, doc/grep.1, NEWS: Document --label
46 * po/ru.po: Sync with translation project
47 * po/grep.pot: Sync with source
48
492002-01-18 Bernhard Rosenkraenzer <bero@redhat.com>
50 * src/grep.c: Add --label, based on patch from Stepan Koltsov
51
522001-11-20 Bernhard Rosenkraenzer <bero@redhat.com>
53 * autogen.sh: Don't hardcode aclocal dir
54
552001-11-19 Bernhard Rosenkraenzer <bero@redhat.com>
56 * src/grep.c: Add --only-matching (-o) switch (see NEWS)
57 * doc/grep.texi, doc/grep.1, NEWS: Document changes
58 * configure.in, lib/Makefile.am: Don't use internal getopt if
59 we're on a system that provides a working getopt function
60
612001-09-25 Bernhard Rosenkraenzer <bero@redhat.com>
62 * configure.in: Detect pcre correctly even when it's in
63 non-standard locations, using pcre-config
64 * src/grep.c: Add --color={always,never,tty} argument (like in ls)
65 * src/grep.c: Turn off blinking in the default colorization
66 * src/grep.c: Add --devices (-D) switch (analogous to --directories)
67 * src/dfa.c: Fix an i18n bug: echo "A" | grep '[A-Z0-9]' wouldn't work
68 in non-C-Locales on systems using current versions of glibc.
69 * AUTHORS: Change maintainer, credit Alain for his work until now
70 * configure.in, m4/decl.m4, m4/dosfile.m4, m4/gettext.m4,
71 m4/init.m4, m4/install.m4, m4/largefile.m4, m4/lcmessage.m4,
72 m4/header.m4, m4/isc-posix.m4, m4/missing.m4, m4/progtest.m4,
73 m4/sanity.m4:
74 Fix build with autoconf 2.5x, retain 2.1x compatibility for now
75 * autogen.sh: Add some crude hacks to make it possible to build with
76 both autoconf 2.5x and 2.1x
77 * acconfig.h: removed (no longer required)
78 * Makefile.am: add cvs-clean target
79 * doc/grep.texi, doc/grep.1, NEWS: Document changes
80 (--color, --devices, -D)
81 * src/dfa.c, src/grep.c: Add vim modelines
82
832001-08-30 Alain Magloire
84
85 * configure.in: Add gl in ALL_LINGUAS.
86
872001-08-30 Kurt D Schwehr
88
89 * doc/grep.1: Warn that grep insert a "--" between groups of matches,
90 when using the context options.
91 * doc/grep.texi: Likewised.
92
932001-08-25 Heikki Korpela
94
95 * doc/grep.texi: Point out that some Platforms do not support
96 reading of directories and silently ignore them.
97
982001-08-21 Alain Magloire
99
100 * lib/malloc.c: New file:
101 * lib/realloc.c: New file:
102 * lib/Makefile.am: Add malloc.c and realloc.c in EXTRA_DIST.
103
1042001-07-31 Alain Magloire
105
106 * po/*.po: New files from the translation team:
107 grep-2.5e.de.po grep-2.5e.el.po grep-2.5e.eo.po grep-2.5e.es.po
108 grep-2.5e.et.po grep-2.5e.fr.po grep-2.5e.gl.po grep-2.5e.it.po
109 grep-2.5e.pl.po grep-2.5e.sl.po
110
1112001-07-31 Andreas Schwab
112
113 * src/grep.c: Fix all uses of error to pass a proper format
114 string.
115
1162001-07-29 Alain Magloire
117
118 * grep/src/grep.c (usage): Typos corrected.
119 Patches from Santiago Vila.
120
1212001-07-29 Alain Magloire
122
123 David Clissold, wrote:
124 a small bug in the GNU grep 2.4.2, which may have gone unnoticed
125 because it only causes a failure if building on a system with large
126 files enabled (e.g. an "off_t" is a "long long" rather than a "long").
127 savedir() takes on off_t argument, but in grepdir() the parameter
128 is cast to an (unsigned). Well, if an off_t is larger than an int,
129 the value gets truncated. This would not normally have an effect on a
130 little-endian platform (unless the file is >2GB), but on a big-endian
131 system it will always fail. The external effect is that
132 "grep -r foo dir_name" fails with ENOMEM (from malloc() within
133 savedir()).
134
135 * grep/src/grep.c (grepdir): Remove the (unsigned) cast when calling
136 savedir().
137 Patch from David Clissold.
138
1392001-07-29 Alain Magloire
140
141 * grep/doc/grep.texi: In Bugs report use {n,m} for consistency.
142 * grep/doc/grep.1: Likewised.
143 Noted by Steven Lucy.
144
1452001-04-27 Isamu Hasegawa
146
147 * dfa.c (mblen_buf) : New variable contains the amount of remain
148 byte of corresponding multibyte character in the input string.
149 (SKIP_REMAIN_MB_IF_INITIAL_STATE) : Use mblen_buf.
150 (match_anychar) : Use mblen_buf.
151 (match_mb_charset) : Use mblen_buf.
152 (transit_state_consume_1char) : Use mblen_buf.
153 (transit_state) : Use inputwcs to get current (multibyte) character.
154 (dfaexec) : Add initialization of mblen_buf.
155
1562001-04-27 Isamu Hasegawa
157
158 * dfa.c (addtok) : Set appropriate value to multibyte_prop.
159 (dfastate) : Add the initialization of the variable.
160 (dfaexec) : Call transit_state if d->fail may transit by
161 multibyte characters.
162 (transit_state_singlebyte) : Clean up unnecessary code.
163 (transit_state_consume_1char) : Likewise.
164 (transit_state) : Add checking for word and newline.
165
1662001-04-19 Isamu Hasegawa
167
168 * search.c (check_multibyte_string) : Check the case when mbclen == 0.
169
1702001-04-11 Isamu Hasegawa
171
172 * search.c (check_multibyte_string) : Check the head of multibyte
173 characters, and optimize a bit.
174 (EGexecute) : Optimize a bit.
175 (Fexecute) : Fix the index.
176
1772001-04-02 Alain Magloire
178
179 * lib/regex.c: Update from GNU lib C, with the changes
180 provided by Paul Eggert.
181 * lib/posix/regex.h: Likewise.
182
1832001-02-17 Paul Eggert
184
185 Stop trying to support hosts that have nonstandard declarations for
186 mbrtowc and/or mbstate_t. It's not worth the portability hassle.
187
188 * lib/quotearg.c (mbrtowc, mbsinit): Remove workaround macros
189 for hosts that have mbrtowc but not mbstate_t, as we now
190 insist on proper declarations for both before using mbrtowc.
191
1922001-03-18 Alain Magloire
193
194 * configure.in: Call AC_MBSTATE_T.
195 * Makefile.am: Add mbstate_t.m4
196 * m4/Makefile.am: Add mbstate_t.m4
197 * m4/mbstate_t.m4: New m4 macro.
198 * lib/strtol.c: Define CHAR_BITS.
199 Uwe H. Steinfeld, Ruslan Ermilov, Volkert Bochert, noted
200 that mbstate_t was not define for certain platforms.
201
2022001-03-18 Paul Eggert
203
204 * src/grep.c (fillbuf): Fix storage allocation performance
205 bug: buffer was doubling in size in many cases where it didn't
206 have to.
207
2082001-03-17 Paul Eggert
209
210 * src/grep.c (fillbuf): Avoid unnecessary division by 2.
211 Don't check xrealloc return value; it's guaranteed to be nonzero.
212 (fillbuf, grepdir): Use xalloc_die rather than error; it's shorter.
213
2142001-03-17 Alain Magloire
215
216 * src/grep.c (context_length_arg): error () passing wrong format.
217 Spotted by Jim Meyering.
218
2192001-03-07 Alain Magloire
220
221 * README-alpha: Removed reference to GNU tar, add the location
222 of the CVSROOT.
223
2242001-03-06 Alain Magloire
225
226 Only the Regex patterns should be split in an array, patterns[].
227 The dfa and KWset compiled patterns should remain global and the
228 patterns compiled all at once.
229
230 * src/search.c: include "error.h" and "xalloc.h" to get prototyping
231 of x*alloc() and error().
232 (kwsinit): Reverse to previous behaviour and takes no argument.
233 (kwsmusts): Likewised.
234 (Gcompile): For the regex pattern, split them and each pattern
235 is put in different compiled structure patterns[]. The patterns
236 are given to dfacomp() and kwsmusts() as is.
237 (Ecompile): Likewised.
238 (Fcompile): Reverse to the old behaviour of compiling the enire
239 patterns in one shot.
240 (EGexecute): If falling to GNU regex for the matching, loop in the
241 array of compile patterns[] to find a match.
242 (error): Many error () were call with arguments in the wrong order.
243 * tests/file.sh: Simple test to check for pattern in files.
244
245 Reaction to bug report fired by Greg Louis <glouis@dynamicro.on.ca>
246
2472001-03-06 Isamu Hasegawa
248
249 In multibyte environments, handle multibyte characters as single
250 characters in bracket expressions.
251
252 * src/dfa.h (mb_char_classes) : new structure.
253 (mbcsets): new variable.
254 (nmbcsets): new variable.
255 (mbcsets_alloc) : new variable.
256 * src/dfa.c (prtok) : handle MBCSET.
257 (fetch_wc): new function to fetch a wide character.
258 (parse_bracket_exp_mb) : new function to handle multibyte character
259 in lex().
260 (lex): invoke parse_bracket_exp_mb() for multibyte bracket expression.
261 (atom): handle MBCSET.
262 (epsclosure): likewise.
263 (dfaanalyze): likewise.
264 (dfastate): likewise.
265 (match_mb_charset): new function to judge whether a bracket match
266 with a multibyte character.
267 (check_matching_with_multibyte_ops) : handle MBCSET.
268 (dfainit): initialize new variables.
269 (dfafree): free new variables.
270
2712001-03-04 Alain Magloire
272
273 To get more in sync with other GNU utilities like GNU tar and fetish
274 all the supporting functions are now under lib.
275 Thanks to Jim Meyering, Volkert Bochert and Paul Eggert for
276 the code and the reminders.
277
278 * src/grep.c (fatal): Function removed, using error () from
279 lib/error.c instead.
280 (usage): Copyright updated.
281 (error): Function removed, using error () from lib/error.c instead,
282 adjust prototypes.
283 (prog): Global variable rename to program_name, to work with new
284 lib/error.c.
285 (xrealloc): Removed using lib/xmalloc.c.
286 (xmalloc): Removed using lib/xmalloc.c
287 (main): Register with atexit() to check for error on stdout.
288 * configure.in: Check for atexit(), call jm_MALLOC, jm_RELLOC and
289 jm_PREREQ_ERROR.
290 * tests/bre.awk: Removed the hack to drain the buffer since we
291 always fclose(stdout) atexit.
292 * tests/ere.awk: Likewise.
293 * tests/spencer1.awk: Likewise.
294 * bootstrap/Makefile.try: Update the Makefile to reflect the changes
295 in the new hierarchy.
296
297 * README-alpha: New File.
298 * m4/realloc.m4: New File.
299 * m4/malloc.m4: New File.
300 * m4/error.m4: New File.
301 * m4/Makefile.am: Updated.
302 * lib: New directory.
303 * lib/Makefile.am: New file.
304 * lib/closeout.c: New file.
305 * lib/closeout.h: New file.
306 * lib/fnmatch.c: New file.
307 * lib/fnmatch.h: New file.
308 * lib/atexit.c: New file.
309 * lib/error.c: New file.
310 * lib/error.h: New file.
311 * lib/quotearg.h: New file.
312 * lib/quotearg.c: New file.
313 * lib/xmalloc.c: New file.
314 * lib/posix: New directory.
315 * lib/posix/Makefile.am: New file.
316 * src/getopt.c: Moved to lib.
317 * src/getopt1.c: Moved to lib.
318 * src/getopt.h: Moved to lib.
319 * src/alloca.c: Moved to lib.
320 * src/exclude.c: Moved to lib.
321 * src/exclude.h: Moved to lib.
322 * src/hard-locale.h: Moved to lib.
323 * src/hard-locale.c: Moved to lib.
324 * src/isdir.c: Moved to lib.
325 * src/mechr.c: Moved to lib.
326 * src/obstack.c: Moved to lib.
327 * src/obstack.h: Moved to lib.
328 * src/regex.c: Moved to lib.
329 * src/regex.h: Moved to lib.
330 * src/posix: Moved to lib.
331 * src/posix/regex.h: Moved to lib.
332 * src/savedir.h: Moved to lib.
333 * src/savedir.c: Moved to lib.
334 * src/stpcpy.c: Moved to lib.
335 * src/strtoul.c: Moved to lib.
336 * src/strtol.c: Moved to lib.
337 * src/strtoull.c: Moved to lib.
338 * src/strtoumax.c: Moved to lib.
339 * src/xstrtol.c: Moved to lib.
340 * src/xstrtol.h: Moved to lib.
341 * src/xstrtoumax.c: Moved to lib.
342
3432001-03-01 Isamu Hasegawa
344
345 Implement the mechanism to match with multibyte characters,
346 and use it for `period' in multibyte environments.
347
348 * dfa.h (mbps): new variable.
349 * dfa.c (prtok): handle ANYCHAR.
350 (lex): use ANYCHAR for `period' in multibyte environments.
351 (atom): handle ANYCHAR.
352 (state_index): initialize mbps in multibyte environments.
353 (epsclosure): handle ANYCHAR.
354 (dfaanalyze): handle ANYCHAR.
355 (dfastate): handle ANYCHAR.
356 (realloc_trans_if_necessary): new function.
357 (transit_state_singlebyte): new function.
358 (match_anychar): new function.
359 (check_matching_with_multibyte_ops): new function.
360 (transit_state_consume_1char): new function.
361 (transit_state): new function.
362 (dfaexec): invoke transit_state if expression can match with
363 a multibyte character in multibyte environments.
364 (dfamust): handle ANYCHAR.
365
3662001-03-01 Alain Magloire
367
368 * src/exclude.c: New file.
369 * src/exclude.h: New file.
370 * src/grep.c (main): Took the GNU tar code to handle
371 the option --include, --exclude, --exclude-from.
372 Files are check for a match, with exlude_filename ().
373 New option --exclude-from.
374 * src/savedir.c: Call exclude_filename() to check for
375 file pattern exclusion or inclusion.
376 * configure.in: --disable-pcre rename to --disable-perl-regexp.
377
378
3792001-02-25 Alain Magloire
380
381 * src/dfa.c: Typo corrected.
382 Noted by Isamu Hasegawa.
383 * src/savedir.c: Typos corrected.
384
3852001-02-22 Alain Magloire
386
387 * src/savedir.c (isdir1): New function, calling isdir with
388 the correct pathname.
389
3902001-02-19 Isamu Hasegawa
391
392 Avoid incorrect state transition in multibyte environments.
393
394 * dfa.h (nmultibyte_prop): new variable.
395 (multibyte_prop): new variable.
396 * dfa.c (addtok): set inputwcs.
397 (dfastate): avoid incorrect state transition in multibyte
398 environments.
399 (dfaexec): likewise.
400 (dfainit): init multibyte_prop.
401 (dfafree): free multibyte_prop.
402 (inputwcs): new variable.
403
4042001-02-19 Isamu Hasegawa
405
406 Handle a multibyte character followed by '*', '+', and '{n,m}'
407 correctly.
408
409 * dfa.c (update_mb_len_index): new function.
410 Support for multibyte string.
411 (FETCH): call update_mb_len_index.
412 (lex): check cur_mb_index not to misunderstand multibyte characters.
413 (atom): make a tree from a multibyte character.
414 (dfaparse): initialize new variables.
415 (mbs): new variable.
416 (cur_mb_len): new variable.
417 (cur_mb_index): new variable.
418
4192001-02-18 Jim Meyering
420
421 * m4/dosfile.m4 (AC_DOSFILE): Move AC_DEFINEs out of AC_CACHE_CHECK.
422
4232001-02-17 Alain Malgoire
424
425 * doc/grep.texi: Document the new options and the new behaviour
426 back-references are local. Use excerpt from Karl Berry regex
427 texinfo.
428
429 * bootstrap/Makefile.try: Added xstrtoumax.o xstrtoul.o hard-local.o
430
4312001-02-17 Alain Magloire
432
433 From Guglielmo 'bond' Bondioni :
434 The bug was that using a multi line file that contained REs (one per
435 line), backreferences in the REs were considered global (to the file)
436 and not local (to the line).
437 That is, \1 in line n refers to the first \(.\) in the whole file,
438 rather than in the line itself.
439
440 From Tapani Tarvainen :
441 # Re: grep -e '\(a\)\1' -e '\(b\)\1'
442 That's not the way it should work: multiple -e arguments
443 should be treated as independent patterns and back references
444 should not refer to previous ones.
445
446 From Paul Eggert :
447 GNU grep currently does not issue
448 diagnostics for the following two cases, both of which are erroneous:
449 grep -e '[' -e ']'
450 grep '[
451 ]'
452 POSIX requires a diagnostic in both cases because '[' is not a valid
453 regular expression.
454
455 To overcome those problems, grep no longer pass the concatenate
456 patterns to GNU regex but rather compile each patterns separately
457 and keep the result in an array.
458
459 * src/search.c (patterns): New global variable; a structure array
460 holding the compiled patterns.
461 Declare function prototypes to minimize error.
462 (dfa, kswset, regexbuf, regs): Removed, no longer static globals, but
463 rather fields in patterns[] structure per motif.
464 (Fcompile): Alloc an entry in patterns[] to hold the regex.
465 (Ecompile): Alloc an entry per motif in the patterns[] array.
466 (Gcompile): Likewise.
467 (EGexecute): Loop through of array of patterns[] for a match.
468
4692001-02-17 Alain Magloire
470
471 From Bernd Strieder :
472 # tail -f logfile | grep important | do_something_urgent
473 # tail -f logfile | grep important | do_something_taking_very_long
474 If grep does full buffering in these cases then the urgent operation
475 does not happen as it should in the first case, and in the second case
476 time is lost due to waiting for the buffer to be filled.
477 This is clearly spoken not grep's fault in the first place, but libc's.
478 There is a heuristic in libc that make a stream line-buffered only if a
479 terminal is on the other end. This doesn't take care of the cases where
480 this connection is somehow indirect.
481
482 * src/grep.c (line_buffered): new option variable.
483 (prline): if line_buffered is set fflush() is call.
484 (usage): line_buffered new option.
485 Input from Paul Eggert, doing setvbuf() may not be portable
486 and breaks grep -z.
487
4882001-02-16 Alain Magloire
489
490 Patch from Isamu Hasegawa, for multibyte support.
491 This patch prevent kwset_matcher from following problems.
492 For example, in SJIS encoding, one character has the codepoint 0x895c.
493 So the second byte of the character can match with '\' incorrectly.
494 And in eucJP encoding, there are the characters whose codepoints are
495 0xa5b9, 0xa5c8. On the other hand, there is one character whose
496 codepoint is 0xb9a5. So 0xb9a5 can match with 2nd byte of 0xa5b9
497 and 1st byte of 0xa5c8.
498
499 * configure.in: Add check for mbrtowc.
500 * src/search.c (check_multibyte_string): new function.
501 Support for multibyte string.
502 (EGexecute): call check_multibyte_string when kwset is set.
503 (Fexecute): call to check_multibyte_string.
504 (MBS_SUPPORT): new macro.
505 (MB_CUR_MAX): new macro.
506
5072001-02-16 Alain Magloire
508
509 * djgpp/config.bat: Fix for 4dos.com.
510 * m4/dosfile.m4 (HAVE_DOS_FILE_CONTENTS): Was not set.
511 Bugs noted and patched by Juan Manuel Guerrero.
512
5132001-02-16 Alain Magloire
514
515 A much requested feature, the possibility to select
516 files when doing recurse :
517 # find . -name "*.c" | xargs grep main {}
518 # grep --include=*.c main .
519 # find . -not -name "*.c" | xargs grep main {}
520 # grep --exclude=*.c main .
521
522 * src/grep.c (short_options): -R equivalent to -r.
523 (#ifdef) : Fix some inconsistencies in the use of #ifdefs, prefer
524 #if defined() wen possible.
525 (long_options): Add --color, --include and exclude.
526 (Usage): Description of new options.
527 (color): Rename color variable to color_option.
528 Removed 'always|never|auto' arguments, not necessary for grep.
529 (exclude_pattern): new variable, holder for the file pattern.
530 (include_pattern): new variable, hoder for the file pattern.
531 * src/savedir.c: Signature change, take two new argmuments.
532 * doc/grep.texi: Document, new options.
533 * doc/grep.man: Document, new options.
534
5352001-02-09 Alain Magloire
536
537 * src/grep.c (long_options): Added equivalent to -r with -R.
538 * src/grep.c (usage): added --color and --colour.
539 Noted with patch from, H.Merijn Brand and Wichert Akkerman.
540
5412001-02-09 Alain Magloire
542
543 Patch from Ulrich Drepper to provide hilighting.
544
545 * src/grep.c: New option --color.
546 (color): New static var.
547 (COLOR_OPTION): new constant.
548 (grep_color): new static var.
549 (prline): Now when color is set prline() will call the current matcher
550 to find the offset of the matching string.
551 * src/savedir.c: Take advantage of _DIRENT_HAVE_TYPE if supported.
552 * src/search.c (EGexecute, Fexecute, Pexecute): Take a new argument
553 when doing exact match for the color hiligting.
554
5552000-09-01 Brian Youmans
556
557 * doc/grep.texi: Typo fixes.
558
5592000-08-30 Paul Eggert
560
561 * doc/grep.texi (Usage): Talk about what "grep -r hello *.c"
562 means.
563
5642000-08-20 Paul Eggert
565
566 Handle range expressions correctly even when they match
567 strings with two or more characters.
568
569 * src/dfa.h (CRANGE): New enum value. Comment fix.
570
571 * src/dfa.c: Include <locale.h> if HAVE_SETLOCALE.
572 Include "hard-locale.h".
573 (prtok): Print CRANGE.
574 (hard_LC_COLLATE): New static var.
575 (lex): Return CRANGE when parsing a character range in a hard locale.
576 Don't use strcoll; it's no longer needed and wasn't correct anyway.
577 Use unsigned rather than token to hold unsigned chars.
578 (addtok): Comment fix.
579 (atom): Treat a CRANGE as if it were (.\1), approximately.
580 (dfaparse): Initialize hard_LC_COLLATE.
581
582 * src/Makefile.am (base_sources): Add hard-locale.c, hard-locale.h.
583
584 * src/hard-locale.c, src/hard-locale.h: New files, taken from
585 textutils.
586
5872000-08-20 Paul Eggert
588
589 * tests/Makefile.am (TESTS_ENVIRONMENT): Add LC_ALL=C, since
590 some of the tests assume the C locale.
591
5922000-08-16 Paul Eggert
593
594 * src/search.c (Gcompile, Ecompile): -x overrides -w, for
595 consistency with fgrep. Don't assume that sizes fit in 'int'.
596 Fix comments to match code.
597
5982000-06-06 Paul Eggert
599
600 * src/grep.c (grepdir): Don't look at st_dev when testing for
601 Mingw32 bug.
602
6032000-06-05 Paul Eggert
604
605 Port to Mingw32, based on suggestions from Christian Groessler
606 <cpg@aladdin.de>.
607
608 * src/isdir.c: New file, taken from fileutils.
609
610 * src/Makefile.am (base_sources): Add isdir.c.
611
612 * src/grep.c (grepfile): Use isdir instead of doing it inline.
613 (grepdir): Suppress ancestor check if the directory's inode and device
614 are both zero, as that occurs only on Mingw32 which doesn't support
615 inode or device.
616
617 * src/system.h (isdir): New decl.
618 (is_EISDIR): Depend on HAVE_DIR_EACCES_BUG, not D_OK.
619 Use isdir, not access.
620
6212000-06-02 Paul Eggert
622
623 Problen noted by Gerald Stoller <gerald_stoller@hotmail.com>
624
625 * src/grep.c (main): POSIX.2 says that -q overrides -l, which
626 in turn overrides the other output options. Fix grep to
627 behave that way.
628
6292000-05-27 Paul Eggert
630
631 Simplify and tune the buffer allocation strategy. Do not reserve a
632 large save area: reserve only enough bytes to hold the residue, plus
633 page alignment. Put a newline sentinel before the buffer, for speed
634 when searching backwards for newline.
635
636 * src/grep.c (ubuffer, bufsalloc, PREFERRED_SAVE_FACTOR, page_alloc):
637 Remove. All uses changed.
638 (INITIAL_BUFSIZE): New macro.
639 (reset, fillbuf): Use simpler buffer allocation strategy.
640 (reset): Check for preposterously large pagesize that would cause
641 later calculations to overflow.
642 (fillbuf): Do not resize buffer if there's room at the end for
643 at least one more page. This greatly increases performance when
644 reading from non-regular files that contain no newlines.
645 When growing the buffer, double its size instead of using a
646 more complicated algorithm.
647 (prtext, grep): Speed up by relying on the newline sentinel before the
648 start of the buffer.
649 (grep): When looking backwards for the last newline in a buffer,
650 stop when we hit the residue, since it can't contain a newline.
651 This avoids an O(N**2) algorithm when reading binary data from
652 a pipe. Use a sentinel to speed up the backward search for newline.
653 (nlscan): Undo previous change; it wasn't needed and just complicates
654 and slows down the code a tad.
655
6562000-05-24 Paul Eggert
657
658 Handle very large input counts better. Bug noted by Jim Meyering.
659
660 * src/grep.c (totalcc, totalnl): Use uintmax_t, not off_t.
661 (add_count): New function.
662 (nlscan, prline, grep): Use it to check line and byte count overflows.
663 (nlscan, grep): Don't keep track of counts when not asked to; this
664 avoids unnecessary overflow diagnostics.
665 (print_offset_sep): Now takes args of type uintmax_t and char,
666 not off_t and int.
667
6682000-05-16 Paul Eggert
669
670 Problem reported by Bob Proulx <rwp@hprwp.fc.hp.com>, this patch
671 is base on his finding, with appropiate corrections.
672
673 * src/grep.c (main): Fix bug: -x and -w matched even when no
674 patterns were specified.
675 * tests/empty.sh: Test for -x and -w bug in grep 2.4.2.
676
6772000-04-24 Paul Eggert
678
679 POSIX.2 conformance fixes: grep -q now exits with status zero
680 if an input line is selected, even if an error also occurs.
681 grep -s no longer affects exit status.
682
683 * src/grep.c (suppress_errors): Move definition earlier so
684 that suppressible_error can use it.
685 (suppressible_error): New function.
686 (exit_on_match): New var.
687 (grepbuf): If exit_on_match is nonzero, exit with status zero
688 immediately.
689 (grep, grepfile, grepdir): Invoke suppressible_error.
690 (main): -q sets exit_on_match.
691
692 * doc/grep.1, doc/grep.texi, NEWS:
693 Document -q's behavior as required by POSIX.2.
694
695 * tests/status.sh:
696 Test for -q and -s behavior as conforming to POSIX.2.
697
6982000-04-20 Paul Eggert
699
700 * tests/Makefile.am (TESTS_ENVIRONMENT):
701 Set GREP_OPTIONS to the empty string.
702
7032000-04-20 Paul Eggert
704
705 * tests/status.sh: Fix typo: test -b -> test -r.
706
7072000-04-20 Paul Eggert
708
709 * src/dfa.c (lex):
710 Do not assume that [c] is equivalent to [c-c]; this isn't true
711 if LC_COLLATE specifies that some characters are equivalent.
712 (setbit_case_fold): New function.
713 (lex): Use it to simplify the code a bit.
714
7152000-04-17 Paul Eggert
716
717 Do CRLF munging only if HAVE_DOS_FILE_CONTENTS, instead of
718 having it depend on O_BINARY (which leads to incorrect results
719 on BeOS, VMS, and MacOS).
720
721 * bootstrap/Makefile.try (DEFS): Add -DHAVE_DOS_FILE_CONTENTS.
722 * src/system.h (SET_BINARY): Define only if HAVE_DOS_FILE_CONTENTS.
723 (O_BINARY): Do not define.
724
725 * m4/dosfile.m4: Define HAVE_DOS_FILE_CONTENTS if it appears we're
726 using DOS.
727
728 * src/grep.c (undossify_input, fillbuf, dosbuf.c, prline, main):
729 Depend on HAVE_DOS_FILE_CONTENTS, not O_BINARY, when handling CRLF
730 matters.
731 (grepfile, main): Depend on SET_BINARY, not O_BINARY, when
732 handling binary files on hosts that care about text versus binary.
733
7342000-04-17 Paul Eggert
735
736 * lib/getpagesize.h (getpagesize): Define to B_PAGE_SIZE if
737 __BEOS__ is defined. Based on a fix by Bruno Haible
738 <haible@clisp.cons.org>.
739
7402000-04-17 Bruno Haible
741
742 * src/system.h [BeOS]: Ignore O_BINARY.
743 * src/getpagesize.h [BeOS]: Define getpagesize() as B_PAGE_SIZE.
744
7452000-04-10 Paul Eggert
746
747 * doc/grep.1, doc/grep.texi, NEWS: -C now requires an operand.
748 * src/grep.c (short_options, long_options, main, usage): Likewise.
749 (context_length_arg): Renamed from ck_atoi. Now reports an error
750 and exits if the number is out of range for a context length.
751 (get_nondigit_option): New function, which checks for overflow
752 correctly, and which does not parse nonadjacent strings of digits
753 into a single number.
754 (main): Use get_nondigit_option instead of doing the code inline.
755 With -A, -B, and -C, optarg is now guaranteed to be nonzero.
756
7572000-04-08 Paul Eggert
758
759 Now that we know that the input is always terminated by a
760 newline before the matching algorithms see it, clean up the
761 matching algorithms so that they no longer need to modify the
762 input by inserting a sentinel newline, and no longer worry
763 about running off the end of the buffer due to a missing sentinel.
764
765 * src/grep.c (nlscan, prpending, prtext, grepbuf): Do not
766 worry about running off the end of the input buffer, since
767 it's now guaranteed to end in the sentinel newline.
768 * src/search.c (EGexecute, Pexecute): Likewise.
769
770 * src/dfa.c (prtok, dfasyntax, dfaparse, copy, merge, state_index,
771 epsclosure, dfaexec, dfacomp):
772 Change many instances of "T *" to "T const *", to catch
773 any inadvertent programming errors made during this conversion.
774 * src/dfa.h (dfacomp, dfaexec, dfaparse): Likewise.
775 * src/grep.c (struct stats.parent, long_options, grepdir,
776 compile, execute, fillbuf, lastnl, lastout, nlscan, prline,
777 prpending, prtext, grepbuf, grep, grepfile, grepdir): Likewise.
778 * src/grep.h (struct matcher.compile, struct matcher.execute):
779 Likewise.
780 * src/kwset.c (struct kwset.trans, kwsalloc, kwsincr, treefails,
781 treedelta, hasevery, treenext, bmexec, cwexec, kwsexec): Likewise.
782 * src/kwset.h (kwsalloc, kwsincr, kwsexec): Likewise.
783 * src/search.c (kwsmusts, Gcompile, Ecompile, EGexecute, Pcompile,
784 Pexecute): Likewise.
785
786 * src/dfa.c (dfaexec):
787 Use size_t, not char *, to avoid worrisome casts to convert
788 char const * to char *.
789 * src/dfa.h (dfaexec): Likewise.
790 * src/grep.c (execute): Likewise.
791 * src/grep.h (execute): Likewise.
792 * src/kwset.c (bmexec, cwexec, kwsexec): Likewise.
793 * src/kwset.h (struct kwsmatch.offset, kwsalloc, kwsincr,
794 kwsexec): Likewise.
795 * src/search.c (EGexecute, Fexecute, Pexecute): Likewise.
796
797 * src/dfa.h (_PTR_T): Depend on defined __STDC__, not __STDC__.
798 (PARAMS): Depend on PROTOTYPES, not __STDC__.
799
800 * src/dfa.c (dfasyntax): Last arg is unsigned char, not int.
801 * src/dfa.h (dfasyntax): Likewise.
802
803 * src/dfa.h (struct dfa): Remove member newlines; no longer needed.
804 * src/dfa.c (build_state, dfaexec, dfafree): Do not worry
805 about special newline state.
806
807 * src/search.c (matchers): Move definition to end of file, so
808 that we don't need forward decls.
809 (lastexact): Remove.
810 (kwset_exact_matches): New var; subsumes old lastexact var.
811 All uses changed.
812
813 * src/dfa.c (index): Remove macro.
814 (REALLOC_IF_NECESSARY): Skip unnecessary test.
815 (tstbit, setbit, clrbit): Declare arg to be unsigned, to help compiler.
816 (copyset, zeroset, equal): Use C builtin primitives, to help compiler.
817 (dfaexec): Do not modify input string.
818 Remove newline parameter; no longer needed.
819 (comsubs): Use strchr, not index.
820
821 * src/grep.h (matchers): Use fixed name size, not pointer (as
822 there's no need for the extra flexibility). All uses changed.
823
824 * src/kwset.h (struct kwsmatch.offset): Renamed from beg, with
825 change of type to size_t. All uses changed.
826
827 * src/grep.c (reset): No longer need kludge for dfaexec. Simplify.
828 (reset, grepbuf): Adjust to new interface for 'execute'.
829 (install_matcher): List is now terminated by null compile,
830 not null name.
831 Do not invoke setrlimit if that wouldn't change the limit.
832
833 * src/dfa.c (xcalloc, xmalloc, xrealloc, prtok, tstbit, setbit,
834 clrbit, copyset, zeroset, notset, equal, charclass_index,
835 looking_at, lex, addtok, atom, nsubtoks, copytoks, closure,
836 branch, regexp, copy, insert, merge, delete, state_index,
837 build_state, build_state_zero, icatalloc, icpyalloc, istrstr,
838 ifree, freelist, enlist, comsubs, addlists, inboth):
839 Remove forward decls; no longer needed.
840 * src/grep.c (ck_atoi, usage, error, setmatcher,
841 install_matcher, prepend_args, prepend_default_options,
842 page_alloc, reset, fillbuf, grepbuf, prtext, prpending, prline,
843 print_offset_sep, nlscan, grep, grepfile): Likewise.
844 * src/kwset.c (enqueue, treefails, treedelta, hasevery,
845 treenext, bmexec, cwexec): Likewise.
846 * src/search.c (Gcompile, Ecompile, EGexecute, Fcompile, Fexecute,
847 Pcompile, Pexecute, kwsinit): Likewise.
848
849 * src/search.c (Pcompile): Do not assume newly allocated
850 storage is zeroed.
851
8522000-04-06 Paul Eggert
853
854 * doc/grep.1, doc/grep.texi, NEWS: Improve the explanation of
855 locale-dependent behavior of range expressions. Mention
856 LC_COLLATE, since this affects range expressions.
857
8582000-03-26 Paul Eggert
859
860 * Makefile.am (ACINCLUDE_INPUTS): Add decl.m4, inttypes_h.m4,
861 uintmax_t.m4, ulonglong.m4, xstrtoumax.m4.
862 * m4/Makefile.am (EXTRA_DIST): Likewise.
863
864 * src/Makefile.am (base_sources):
865 Add xstrtol.c, xstrtol.h, xstrtoumax.c.
866 (EXTRA_DIST): Add strtol.c.
867
868 * configure.in (jm_AC_TYPE_UINTMAX_T, jm_AC_PREREQ_XSTRTOUMAX,
869 HAVE_DECL_STRTOUL, HAVE_DECL_STRTOULL): Add.
870 (AC_REPLACE_FUNCS): Add strtoul.
871
872 * src/grep.c: Include xstrtol.h.
873 (ck_atio): Use xstrtoumax and do proper overflow checking.
874 (max_count, outleft): Now off_t, not int.
875 (main): Likewise. Use xstrtoumax to convert max_count from string.
876
877 * acconfig.h (HAVE_DECL_STRTOUL, HAVE_DECL_STRTOULL): New #undefs.
878 (HAVE_STPCPY, ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT,
879 HAVE_LC_MESSAGES): Remove.
880
881 * m4/decl.m4, m4/inttypes_h.m4, m4/uintmax_t.m4, m4/ulonglong.m4,
882 m4/xstrtoumax.m4, src/strtol.c, src/strtoul.c, src/strtoull.c,
883 src/strtoumax.c, src/xstrtol.c, src/xstrtol.h, src/xstrtoumax.c:
884 New files, taken unchanged from textutils, fileutils, sh-utils
885 and/or tar.
886
8872000-03-23 Paul Eggert
888
889 * src/search.c (Pcompile): Add support for NUL bytes in
890 Perl regular expressions.
891
8922000-03-23 Paul Eggert
893
894 * NEWS, doc/grep.1, doc/grep.texi: Change --pcre to --perl-regexp.
895 * src/grep.c (long_options, usage): Likewise.
896
897 * doc/grep.1, doc/grep.texi: Remove pgrep program.
898 * src/Makefile.am (bin_PROGRAMS): Likewise.
899 (pgrep_SOURCES): Remove.
900
901 * src/grep.c (main): Rename matcher from "pgrep" to "perl".
902 * src/search.c (matchers): Likewise.
903
904 * src/search.c: Do not include stdio.h; no longer needed.
905 (NILP): Remove.
906 (sub): No longer static.
907 (n_pcre): Remove.
908 (cre): No longer an array. Present only if HAVE_LIBPCRE.
909 (extra): New variable.
910 (Pcompile): Use fatal to report errors.
911 This also removes a possible core dump.
912 Add checks (marked FIXME) for restrictions in pcre.
913 Use pcre_maketables for proper localized behavior.
914 (Pcompile, Pexecute): Use GNU coding style.
915 The argument is a single pattern, not a list of patterns separated
916 by newlines; this is for consistency with grep and egrep.
917 Use pcre_study for speed.
918 (Pexecute): Abort if we lack pcre.
919 Abort if pcre_exec reports an impossible error.
920 Use code similar to the rest of search.c
921 to narrow down to the line we've found.
922
9232000-03-21 Alain Magloire
924
925 * configure.in: added AC_CHECK_LIB(pcre, pcre_exec)
926 * ChangeLog: Typos corrected.
927 * src/search.c: new MACRO HAVE_LIBPCRE
928
9292000-03-21 H.Merijn Brand
930
931 * src/Makefile.am(bin_PROGRAMS): added pgrep and new macro
932 pgrep_SOURCES.
933 * src/search.c: new functions Pcompile() and Pexecute()
934 to support PCRE. Update matcher[] array for pgrep.
935 * src/grep.c: new short and long option --pcre and -P.
936 usage() updated.
937
9382000-03-21 Bastiaan Stougie
939
940 Improvement of the -m or --max-count option. Now works for NUM > 1 and
941 prints trailing context for the last matching line.
942
943 * src/grep.c
944 (after_last_match): Is a new off_t variable that replaces inputhwm
945 to retain the correct input offset even after a call to fillbuf. Note
946 that after_last_match has a different meaning than inputhwm:
947 it always points to the offset in the input of the first byte after
948 the last matching line, and is 0 if no matching line has been found
949 yet.
950 (grep): Print trailing context after the NUMth match when the -m NUM
951 option is used.
952 (grep): Added comment. Should have been commented already.
953 (grepbuf): Now updates outleft correctly. This fixes the bug that the
954 -m NUM option did not stop after NUM lines for NUM greater than 1.
955 (grepbuf, prtext): Now update after_last_match instead of inputhwm.
956 (fillbuf): No longer updates inputhwm.
957 (prpending): When outputting trailing context of the max_count-th
958 matching line, stop at the first matching line.
959 (grepfile): Seek to after_last_match or eof, depending on the values
960 of outleft and bufmapped.
961 (usage): added the -m or --max-count option to the help message.
962 * doc/grep.texi, doc/grep.1: Document the change of the -m option.
963
9642000-03-17 Paul Eggert
965
966 Add new -m or --max-count option, based on a suggestion by
967 Bastiaan Stougie.
968
969 * doc/grep.texi, doc/grep.1: Document it.
970 * src/grep.c (short_options, long_options, main): Add it.
971 (inputhwm): New variable.
972 (fillbuf, prtext, grepbuf): Set it.
973 (bufmapped): Now a macro (defined to zero) if HAVE_MMAP is not defined.
974 (max_count, outleft): New variables.
975 (prtext, grepbuf, grep): Don't output more than outleft lines.
976 (grepfile): If grepping standard input, seek to the limit of what
977 we've read before exiting. This fixes a bug with mmapped input,
978 and is needed for proper -m support.
979 (main): Exit immediately if -m 0 is specified.
980
12000-03-08 Alain Magloire
2
3 * configure.in: version 2.4.2
4
52000-03-07 Paul Eggert
6
7 * Make intl subdirectory match fileutils, tar, etc.;
8 see intl/ChangeLog for details.

--- 31 unchanged lines hidden (view full) ---

40
41 * djgpp/config.site (prefix, INSTALL): Use /dev/env/DJDIR instead
42 of ${DJDIR}, so that the produced Makefile's work on any DJGPP
43 installation.
44
452000-01-30 Alain Magloire
46
47 * doc/grep.1: corrected typo.
9812000-03-08 Alain Magloire
982
983 * configure.in: version 2.4.2
984
9852000-03-07 Paul Eggert
986
987 * Make intl subdirectory match fileutils, tar, etc.;
988 see intl/ChangeLog for details.

--- 31 unchanged lines hidden (view full) ---

1020
1021 * djgpp/config.site (prefix, INSTALL): Use /dev/env/DJDIR instead
1022 of ${DJDIR}, so that the produced Makefile's work on any DJGPP
1023 installation.
1024
10252000-01-30 Alain Magloire
1026
1027 * doc/grep.1: corrected typo.
48 Noted by Ruslan Ermilob.
1028 Noted by Ruslan Ermilov.
49
502000-01-30 Alain Magloire
51
52 * vms/Makefile.am: added config_vms.h to EXTRA_DIST.
53 * vms/config_vms.h: New File, contains macros specific to VMS and
54 avoid namespace collision with operating system supplied C library.
55 * vms/make.com: Better compiler auto-detection; information for builds
56 on pre-OpenVMS 7.x systems; general overhaul.

--- 109 unchanged lines hidden (view full) ---

166 version from tar 1.13.17.
167
168 * src/obstack.c, src/obstack.h, src/regex.c, src/regex.h:
169 Upgrade to glibc 2.1.3 alpha 1, with K&R C portability fix.
170 * src/posix/regex.h: New file, from glibc 2.1.3 alpha 1.
171
1722000-01-04 Paul Eggert
173
1029
10302000-01-30 Alain Magloire
1031
1032 * vms/Makefile.am: added config_vms.h to EXTRA_DIST.
1033 * vms/config_vms.h: New File, contains macros specific to VMS and
1034 avoid namespace collision with operating system supplied C library.
1035 * vms/make.com: Better compiler auto-detection; information for builds
1036 on pre-OpenVMS 7.x systems; general overhaul.

--- 109 unchanged lines hidden (view full) ---

1146 version from tar 1.13.17.
1147
1148 * src/obstack.c, src/obstack.h, src/regex.c, src/regex.h:
1149 Upgrade to glibc 2.1.3 alpha 1, with K&R C portability fix.
1150 * src/posix/regex.h: New file, from glibc 2.1.3 alpha 1.
1151
11522000-01-04 Paul Eggert
1153
174 Inititial patch from David O'Brien.
1154 Initial patch by Ruslan Ermilov.
175
176 Add --binary-files option.
177 * NEWS, doc/grep.1, doc/grep.texi: Document it.
178 * src/grep.c (BINARY_FILES_OPTION): New constant.
179 (long_options, grep, usage, main): New --binary-files option.
180 (binary_files): New var.
181 * src/system.h (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, CHAR_MAX):
182 New macros.

--- 1315 unchanged lines hidden ---
1155
1156 Add --binary-files option.
1157 * NEWS, doc/grep.1, doc/grep.texi: Document it.
1158 * src/grep.c (BINARY_FILES_OPTION): New constant.
1159 (long_options, grep, usage, main): New --binary-files option.
1160 (binary_files): New var.
1161 * src/system.h (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, CHAR_MAX):
1162 New macros.

--- 1315 unchanged lines hidden ---