📄 changelog
字号:
(dfainit): init multibyte_prop. (dfafree): free multibyte_prop. (inputwcs): new variable.2001-02-19 Isamu Hasegawa Handle a multibyte character followed by '*', '+', and '{n,m}' correctly. * dfa.c (update_mb_len_index): new function. Support for multibyte string. (FETCH): call update_mb_len_index. (lex): check cur_mb_index not to misunderstand multibyte characters. (atom): make a tree from a multibyte character. (dfaparse): initialize new variables. (mbs): new variable. (cur_mb_len): new variable. (cur_mb_index): new variable.2001-02-18 Jim Meyering * m4/dosfile.m4 (AC_DOSFILE): Move AC_DEFINEs out of AC_CACHE_CHECK.2001-02-17 Alain Malgoire * doc/grep.texi: Document the new options and the new behaviour back-references are local. Use excerpt from Karl Berry regex texinfo. * bootstrap/Makefile.try: Added xstrtoumax.o xstrtoul.o hard-local.o2001-02-17 Alain Magloire From Guglielmo 'bond' Bondioni : The bug was that using a multi line file that contained REs (one per line), backreferences in the REs were considered global (to the file) and not local (to the line). That is, \1 in line n refers to the first \(.\) in the whole file, rather than in the line itself. From Tapani Tarvainen : # Re: grep -e '\(a\)\1' -e '\(b\)\1' That's not the way it should work: multiple -e arguments should be treated as independent patterns and back references should not refer to previous ones. From Paul Eggert : GNU grep currently does not issue diagnostics for the following two cases, both of which are erroneous: grep -e '[' -e ']' grep '[ ]' POSIX requires a diagnostic in both cases because '[' is not a valid regular expression. To overcome those problems, grep no longer pass the concatenate patterns to GNU regex but rather compile each patterns separately and keep the result in an array. * src/search.c (patterns): New global variable; a structure array holding the compiled patterns. Declare function prototypes to minimize error. (dfa, kswset, regexbuf, regs): Removed, no longer static globals, but rather fields in patterns[] structure per motif. (Fcompile): Alloc an entry in patterns[] to hold the regex. (Ecompile): Alloc an entry per motif in the patterns[] array. (Gcompile): Likewise. (EGexecute): Loop through of array of patterns[] for a match.2001-02-17 Alain Magloire From Bernd Strieder : # tail -f logfile | grep important | do_something_urgent # tail -f logfile | grep important | do_something_taking_very_long If grep does full buffering in these cases then the urgent operation does not happen as it should in the first case, and in the second case time is lost due to waiting for the buffer to be filled. This is clearly spoken not grep's fault in the first place, but libc's. There is a heuristic in libc that make a stream line-buffered only if a terminal is on the other end. This doesn't take care of the cases where this connection is somehow indirect. * src/grep.c (line_buffered): new option variable. (prline): if line_buffered is set fflush() is call. (usage): line_buffered new option. Input from Paul Eggert, doing setvbuf() may not be portable and breaks grep -z.2001-02-16 Alain Magloire Patch from Isamu Hasegawa, for multibyte support. This patch prevent kwset_matcher from following problems. For example, in SJIS encoding, one character has the codepoint 0x895c. So the second byte of the character can match with '\' incorrectly. And in eucJP encoding, there are the characters whose codepoints are 0xa5b9, 0xa5c8. On the other hand, there is one character whose codepoint is 0xb9a5. So 0xb9a5 can match with 2nd byte of 0xa5b9 and 1st byte of 0xa5c8. * configure.in: Add check for mbrtowc. * src/search.c (check_multibyte_string): new function. Support for multibyte string. (EGexecute): call check_multibyte_string when kwset is set. (Fexecute): call to check_multibyte_string. (MBS_SUPPORT): new macro. (MB_CUR_MAX): new macro.2001-02-16 Alain Magloire * djgpp/config.bat: Fix for 4dos.com. * m4/dosfile.m4 (HAVE_DOS_FILE_CONTENTS): Was not set. Bugs noted and patched by Juan Manuel Guerrero.2001-02-16 Alain Magloire A much requested feature, the possibility to select files when doing recurse : # find . -name "*.c" | xargs grep main {} # grep --include=*.c main . # find . -not -name "*.c" | xargs grep main {} # grep --exclude=*.c main . * src/grep.c (short_options): -R equivalent to -r. (#ifdef) : Fix some inconsistencies in the use of #ifdefs, prefer #if defined() wen possible. (long_options): Add --color, --include and exclude. (Usage): Description of new options. (color): Rename color variable to color_option. Removed 'always|never|auto' arguments, not necessary for grep. (exclude_pattern): new variable, holder for the file pattern. (include_pattern): new variable, hoder for the file pattern. * src/savedir.c: Signature change, take two new argmuments. * doc/grep.texi: Document, new options. * doc/grep.man: Document, new options.2001-02-09 Alain Magloire * src/grep.c (long_options): Added equivalent to -r with -R. * src/grep.c (usage): added --color and --colour. Noted with patch from, H.Merijn Brand and Wichert Akkerman.2001-02-09 Alain Magloire Patch from Ulrich Drepper to provide hilighting. * src/grep.c: New option --color. (color): New static var. (COLOR_OPTION): new constant. (grep_color): new static var. (prline): Now when color is set prline() will call the current matcher to find the offset of the matching string. * src/savedir.c: Take advantage of _DIRENT_HAVE_TYPE if supported. * src/search.c (EGexecute, Fexecute, Pexecute): Take a new argument when doing exact match for the color hiligting.2000-09-01 Brian Youmans * doc/grep.texi: Typo fixes.2000-08-30 Paul Eggert * doc/grep.texi (Usage): Talk about what "grep -r hello *.c" means.2000-08-20 Paul Eggert Handle range expressions correctly even when they match strings with two or more characters. * src/dfa.h (CRANGE): New enum value. Comment fix. * src/dfa.c: Include <locale.h> if HAVE_SETLOCALE. Include "hard-locale.h". (prtok): Print CRANGE. (hard_LC_COLLATE): New static var. (lex): Return CRANGE when parsing a character range in a hard locale. Don't use strcoll; it's no longer needed and wasn't correct anyway. Use unsigned rather than token to hold unsigned chars. (addtok): Comment fix. (atom): Treat a CRANGE as if it were (.\1), approximately. (dfaparse): Initialize hard_LC_COLLATE. * src/Makefile.am (base_sources): Add hard-locale.c, hard-locale.h. * src/hard-locale.c, src/hard-locale.h: New files, taken from textutils.2000-08-20 Paul Eggert * tests/Makefile.am (TESTS_ENVIRONMENT): Add LC_ALL=C, since some of the tests assume the C locale.2000-08-16 Paul Eggert * src/search.c (Gcompile, Ecompile): -x overrides -w, for consistency with fgrep. Don't assume that sizes fit in 'int'. Fix comments to match code.2000-06-06 Paul Eggert * src/grep.c (grepdir): Don't look at st_dev when testing for Mingw32 bug.2000-06-05 Paul Eggert Port to Mingw32, based on suggestions from Christian Groessler <cpg@aladdin.de>. * src/isdir.c: New file, taken from fileutils. * src/Makefile.am (base_sources): Add isdir.c. * src/grep.c (grepfile): Use isdir instead of doing it inline. (grepdir): Suppress ancestor check if the directory's inode and device are both zero, as that occurs only on Mingw32 which doesn't support inode or device. * src/system.h (isdir): New decl. (is_EISDIR): Depend on HAVE_DIR_EACCES_BUG, not D_OK. Use isdir, not access.2000-06-02 Paul Eggert Problen noted by Gerald Stoller <gerald_stoller@hotmail.com> * src/grep.c (main): POSIX.2 says that -q overrides -l, which in turn overrides the other output options. Fix grep to behave that way.2000-05-27 Paul Eggert Simplify and tune the buffer allocation strategy. Do not reserve a large save area: reserve only enough bytes to hold the residue, plus page alignment. Put a newline sentinel before the buffer, for speed when searching backwards for newline. * src/grep.c (ubuffer, bufsalloc, PREFERRED_SAVE_FACTOR, page_alloc): Remove. All uses changed. (INITIAL_BUFSIZE): New macro. (reset, fillbuf): Use simpler buffer allocation strategy. (reset): Check for preposterously large pagesize that would cause later calculations to overflow. (fillbuf): Do not resize buffer if there's room at the end for at least one more page. This greatly increases performance when reading from non-regular files that contain no newlines. When growing the buffer, double its size instead of using a more complicated algorithm. (prtext, grep): Speed up by relying on the newline sentinel before the start of the buffer. (grep): When looking backwards for the last newline in a buffer, stop when we hit the residue, since it can't contain a newline. This avoids an O(N**2) algorithm when reading binary data from a pipe. Use a sentinel to speed up the backward search for newline. (nlscan): Undo previous change; it wasn't needed and just complicates and slows down the code a tad.2000-05-24 Paul Eggert Handle very large input counts better. Bug noted by Jim Meyering. * src/grep.c (totalcc, totalnl): Use uintmax_t, not off_t. (add_count): New function. (nlscan, prline, grep): Use it to check line and byte count overflows. (nlscan, grep): Don't keep track of counts when not asked to; this avoids unnecessary overflow diagnostics. (print_offset_sep): Now takes args of type uintmax_t and char, not off_t and int.2000-05-16 Paul Eggert Problem reported by Bob Proulx <rwp@hprwp.fc.hp.com>, this patch is base on his finding, with appropiate corrections. * src/grep.c (main): Fix bug: -x and -w matched even when no patterns were specified. * tests/empty.sh: Test for -x and -w bug in grep 2.4.2.2000-04-24 Paul Eggert POSIX.2 conformance fixes: grep -q now exits with status zero if an input line is selected, even if an error also occurs. grep -s no longer affects exit status. * src/grep.c (suppress_errors): Move definition earlier so that suppressible_error can use it. (suppressible_error): New function. (exit_on_match): New var. (grepbuf): If exit_on_match is nonzero, exit with status zero immediately. (grep, grepfile, grepdir): Invoke suppressible_error. (main): -q sets exit_on_match. * doc/grep.1, doc/grep.texi, NEWS: Document -q's behavior as required by POSIX.2. * tests/status.sh: Test for -q and -s behavior as conforming to POSIX.2.2000-04-20 Paul Eggert * tests/Makefile.am (TESTS_ENVIRONMENT): Set GREP_OPTIONS to the empty string.2000-04-20 Paul Eggert * tests/status.sh: Fix typo: test -b -> test -r.2000-04-20 Paul Eggert * src/dfa.c (lex): Do not assume that [c] is equivalent to [c-c]; this isn't true if LC_COLLATE specifies that some characters are equivalent. (setbit_case_fold): New function. (lex): Use it to simplify the code a bit.2000-04-17 Paul Eggert Do CRLF munging only if HAVE_DOS_FILE_CONTENTS, instead of having it depend on O_BINARY (which leads to incorrect results on BeOS, VMS, and MacOS). * bootstrap/Makefile.try (DEFS): Add -DHAVE_DOS_FILE_CONTENTS. * src/system.h (SET_BINARY): Define only if HAVE_DOS_FILE_CONTENTS. (O_BINARY): Do not define. * m4/dosfile.m4: Define HAVE_DOS_FILE_CONTENTS if it appears we're using DOS. * src/grep.c (undossify_input, fillbuf, dosbuf.c, prline, main): Depend on HAVE_DOS_FILE_CONTENTS, not O_BINARY, when handling CRLF matters. (grepfile, main): Depend on SET_BINARY, not O_BINARY, when handling binary files on hosts that care about text versus binary.2000-04-17 Paul Eggert * lib/getpagesize.h (getpagesize): Define to B_PAGE_SIZE if __BEOS__ is defined. Based on a fix by Bruno Haible <haible@clisp.cons.org>.2000-04-17 Bruno Haible * src/system.h [BeOS]: Ignore O_BINARY. * src/getpagesize.h [BeOS]: Define getpagesize() as B_PAGE_SIZE.2000-04-10 Paul Eggert * doc/grep.1, doc/grep.texi, NEWS: -C now requires an operand. * src/grep.c (short_options, long_options, main, usage): Likewise. (context_length_arg): Renamed from ck_atoi. Now reports an error and exits if the number is out of range for a context length. (get_nondigit_option): New function, which checks for overflow correctly, and which does not parse nonadjacent strings of digits into a single number. (main): Use get_nondigit_option instead of doing the code inline. With -A, -B, and -C, optarg is now guaranteed to be nonzero.2000-04-08 Paul Eggert Now that we know that the input is always terminated by a newline before the matching algorithms see it, clean up the matching algorithms so that they no longer need to modify the input by inserting a sentinel newline, and no longer worry about running off the end of the buffer due to a missing sentinel. * src/grep.c (nlscan, prpending, prtext, grepbuf): Do not worry about running off the end of the input buffer, since it's now guaranteed to end in the sentinel newline. * src/search.c (EGexecute, Pexecute): Likewise. * src/dfa.c (prtok, dfasyntax, dfaparse, copy, merge, state_index, epsclosure, dfaexec, dfacomp): Change many instances of "T *" to "T const *", to catch any inadvertent programming errors made during this conversion. * src/dfa.h (dfacomp, dfaexec, dfaparse): Likewise. * src/grep.c (struct stats.parent, long_options, grepdir, compile, execute, fillbuf, lastnl, lastout, nlscan, prline, prpending, prtext, grepbuf, grep, grepfile, grepdir): Likewise. * src/grep.h (struct matcher.compile, struct matcher.execute): Likewise.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -