| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
* src/system.h: Update decls to match current Gnulib.
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
* gnulib: Also update submodule for its copyright updates.
|
|
|
|
|
|
| |
* gnulib: Update to latest.
* all files: Run "make update-copyright".
* bootstrap: Update from gnulib.
|
|
|
|
|
|
| |
* src/system.h (IGNORE_DUPLICATE_BRANCH_WARNING): Define.
* src/grep.c (grepfile): Use it.
* src/kwset.c (bmexec, acexec): Use it.
|
|
|
|
|
|
|
| |
* src/system.h (FALLTHROUGH): Define.
* src/grep.c (context_length_arg): Use new FALLTHROUGH macro in place
of comments
(fgrep_to_grep_pattern, try_fgrep_pattern, main): Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Inspired by a suggestion by Eric Blake (Bug#25707#17).
* bootstrap.conf (gnulib_modules): Add xbinary-io,
and remove binary-io and xfreopen.
* doc/grep.texi (Other Options):
Fix typo and reword to be a bit more general.
* src/grep.c: Include xbinary-io.h instead of xfreopen.h.
(grepfile): Open with O_BINARY if binary.
(grepdesc): No need for set_binary_mode now.
(grep_command_line_arg, main): Set stdin to binary mode if binary.
(main): Avoid unnecessary test of stdin == NULL.
Use xsetmode instead of xfreopen.
* src/system.h: Do not include binary-io.h.
|
|
|
|
|
| |
* gnulib: Update to latest.
* all files: Run "make update-copyright".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These days, the dangerous powers of C macros are not needed if
constants or functions will do just as well.
* src/grep.c (SEP_CHAR_SELECTED, SEP_CHAR_REJECTED, SEP_STR_GROUP)
(INITIAL_BUFSIZE):
* src/kwset.c (DEPTH_SIZE):
Now constants, not macros.
* src/kwset.c (link): Remove macro. Instead, rename local vars
from 'link' to 'cur'.
(malloc) [GREP]: Remove macro. All uses of malloc changed to xmalloc.
Omit double-inclusion of xalloc.h. Do not depend on 'GREP'.
(U): Now a function, not a macro.
* src/kwset.c, src/searchutils.c (NCHAR): Move this macro to ...
* src/system.h: ... here, and make it a constant.
|
|
|
|
|
|
|
|
| |
Run "make update-copyright" and then...
* gnulib: Update to latest.
* tests/init.sh: Update from gnulib.
* bootstrap: Likewise.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This lets us reliably detect with ASAN some UMR bugs
that would otherwise be detectable only some of the time
with MSAN. Use __asan_poison_memory_region to mark the unused
portion of a read buffer as inaccessible. Then, with ASAN,
any attempt to access those bytes results in an ASAN abort.
* src/system.h: Include "ignore-value.h".
(__has_feature): Define.
(HAVE_ASAN): Define when address sanitizer is enabled.
[HAVE_ASAN]: Declare these two __asan_* symbols.
[!HAVE_ASAN] (__asan_poison_memory_region): Define stub.
[!HAVE_ASAN] (__asan_unpoison_memory_region): Likewise.
* src/grep.c: Use __asan_poison_memory_region.
|
|
|
|
|
| |
Run "make update-copyright". Also, ...
* grep.texi: Update manually, converting each "--" to "-".
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* src/grep.c (buffer_textbin, contains_encoding_error):
Use mb_clen for speed.
(buffer_textbin): Bypass mb_clen in unibyte locales.
(main): Always initialize the cache, since it's sometimes used in
unibyte locales now. Initialize it before contains_encoding_error
might be called.
* src/search.h (SEARCH_INLINE): New macro.
(mbclen_cache): Now extern decl.
(mb_clen): New inline function.
* src/searchutils.c (SEARCH_INLINE, SYSTEM_INLINE): Define.
(mbclen_cache): Now extern.
(build_mbclen_cache): Put 1 into the cache when mbrlen returns 0.
(mb_goback): Use mb_len for speed, and rely on it returning nonzero.
* src/system.h (SYSTEM_INLINE): New macro.
(to_uchar): Use it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
While cleaning up the empty-string fix, I noticed that one part of
the code worried about CRLF in pattern files whereas another part
did not. Fix this by using the same approach in both places,
and make the CRLF code more modular in the process.
* src/dosbuf.c (dos_binary, dos_unix_byte_offsets): New functions.
(undossify_input, dossified_pos): Do nothing if ! O_BINARY.
* src/grep.c: Always include dosbuf.c so that the code is
checked statically even on non-DOS hosts.
(dos_binary, dos_unix_byte_offsets): New decls.
(undossify_input): Declare unconditionally.
* src/grep.c (fillbuf, print_line_head, main):
* src/kwsearch.c (Fcompile):
Simplify by not worrying about HAVE_DOS_FILE_CONTENTS.
* src/grep.c (main): fopen with "rt" if O_TEXT; this is simpler
than worrying about HAVE_DOS_FILE_CONTENTS elsewhere.
* src/system.h (HAVE_DOS_FILE_CONTENTS): Remove.
|
|
|
|
|
|
|
|
|
| |
* src/system.h (to_uchar): Define function.
* src/kwsearch.c (Fexecute): Use to_uchar twice in place of casts.
* src/dfasearch.c (EGexecute): Likewise.
* src/main.c (prepend_args): Likewise.
* src/kwset.c (U): Define in terms of to_uchar.
* src/dfa.c (match_mb_charset): Use to_uchar, not an explicit cast.
|
|
|
|
| |
Do that by running "make update-copyright".
|
|
|
|
| |
Run "make update-copyright".
|
|
|
|
|
|
| |
* src/main.c (STREQ): Remove definition.
* src/pcresearch.c: (STREQ): Likewise.
* src/system.h (STREQ): Define it here instead.
|
|
|
|
| |
Run "make update-copyright".
|
|
|
|
|
|
|
|
|
|
| |
* src/main.c (grepfile): Just use SAME_INODE; don't bother
with SAME_REGULAR_FILE. This works better on properly-working
POSIX hosts, since it handles the case where the file is changing
as we grep it. It works worse on hosts that don't support st_ino
properly, but in practice this isn't that much of a problem here.
* src/system.h (same_file_attributes, SAME_REGULAR_FILE):
Remove; no longer needed.
|
|
|
|
|
|
|
|
|
|
|
| |
grep no longer silently suppresses errors when reading a directory
as if it were a text file. For example, "grep x ." now reports a
read error on most systems; formerly, it ignored the error.
Problem reported as an aside by Bob Proulx (Bug#10355).
* NEWS: Document this.
* src/main.c (grep, grepfile): Implement this. Simplify the code
considerably.
* src/system.h (is_EISDIR): Remove; no longer needed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This avoids a potential "infinite" disk-filling loop.
Reported in http://savannah.gnu.org/patch/?5316
and http://savannah.gnu.org/bugs/?17457.
* src/main.c: Include "quote.h".
(out_stat): New global.
(grepfile): Compare each regular file's dev/ino/etc.
with those from the file on stdout (if it too is regular).
(main): Set out_stat, if stdout is a regular file.
* src/system.h: Include "same-inode.h".
(same_file_attributes): Define. From diffutils.
(SAME_REGULAR_FILE): Define.
* bootstrap.conf (gnulib_modules): Use quote, not quotearg.
Use same-inode.
* NEWS (Bug fixes): Mention it.
|
|
|
|
| |
Run "make update-copyright", so "make syntax-check" works in 2011.
|
|
|
|
|
| |
* src/system.h: Add multiple inclusion guards.
* src/grep.h: Likewise.
|
|
|
|
|
|
| |
* bootstrap.conf: Include gnulib module minmax.
* src/searchutils.c (mbtolower): Handle *N == 0 case.
* src/system.h: Include minmax.h from gnulib.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
| |
* src/Makefile.am (INCLUDES): Remove unnecessary definition of
LOCALEDIR here. Now, it's defined via gnulib's configmake.h.
* src/system.h: Include "configmake.h" for its LOCALEDIR definition.
|
|
|
|
|
|
|
| |
* src/system.h (TYPE_MAXIMUM, TYPE_MINIMUM, TYPE_SIGNED): Remove
definitions. They are provided by intprops.h.
* src/grep.c: Include "intprops.h"
* bootstrap.conf (gnulib_modules): Add intprops.
|
|
|
|
|
| |
* src/kwset.h: Declare kwset using an incomplete struct type.
* src/system.h (ptr_t): Remove.
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
|
|
|
|
| |
* cfg.mk (local-checks-to-skip): Remove sc_prohibit_magic_number_exit,
to enable that check.
* src/system.h (EXIT_TROUBLE): Define.
* src/grep.c: Use symbolic names, EXIT_SUCCESS, EXIT_FAILURE, and
EXIT_TROUBLE, not 0, 1, 2.
* src/search.c: Likewise.
* src/vms_fab.c (string): Likewise.
|
|
|
|
|
| |
* src/grep.c: Include "isdir.h".
* src/system.h: Remove declaration of isdir.
|
|
|
|
|
| |
* bootstrap.conf (gnulib_modules): Add unlocked-io.
* src/system.h: Include "unlocked-io.h".
|
|
|
|
|
|
| |
Use this command:
git ls-files |grep -vE '^(\..*|COPYING|gnulib)$' |xargs \
env UPDATE_COPYRIGHT_USE_INTERVALS=1 build-aux/update-copyright
|
|
|
|
|
|
|
|
| |
* bootstrap.conf: Add binary-io, dirname.
* configure.ac: Remove check for setmode, AC_DOSFILE.
* m4/dosfile.m4: Remove.
* src/grep.c: Adjust for dirname.h.
* src/system.h: Adjust for new gnulib modules.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* bootstrap.conf: Add gnulib modules for replacement functions and
headers.
* configure.ac: Remove macros subsumed by gnulib.
* lib/hard-locale.c: Remove guards for headers/functions provided by gnulib.
* lib/regex.c: Likewise.
* lib/savedir.c: Likewise.
* src/dfa.c: Likewise.
* src/dfa.h: Do not look at PROTOTYPES.
* src/grep.c: Likewise.
* src/mbsupport.h: Likewise.
* src/system.h: Likewise.
* m4/mbstate_t.m4: Remove.
* src/getpagesize.h: Remove.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* bootstrap.conf: Add gnulib modules and build libgreputils.a.
* configure.ac: Remove macros subsumed by gnulib.
* lib/Makefile.am: Remove files subsumed by gnulib.
* lib/alloca.c: Remove.
* lib/atexit.c: Remove.
* lib/error.c: Remove.
* lib/error.h: Remove.
* lib/fnmatch.c: Remove.
* lib/fnmatch.h: Remove.
* lib/getopt.c: Remove.
* lib/getopt.h: Remove.
* lib/getopt1.c: Remove.
* lib/gettext.h: Remove.
* lib/malloc.c: Remove.
* lib/memchr.c: Remove.
* lib/obstack.c: Remove.
* lib/obstack.h: Remove.
* lib/quotearg.c: Remove.
* lib/quotearg.h: Remove.
* lib/realloc.c: Remove.
* lib/stpcpy.c: Remove.
* lib/strtol.c: Remove.
* lib/strtoul.c: Remove.
* lib/strtoull.c: Remove.
* lib/xalloc.h: Remove.
* lib/xmalloc.c: Remove.
* lib/xstrtol.c: Remove.
* lib/xstrtol.h: Remove.
* lib/xstrtoumax.c: Remove.
* m4/error.m4: Remove.
* m4/inttypes_h.m4: Remove.
* m4/malloc.m4: Remove.
* m4/realloc.m4: Remove.
* m4/uintmax_t.m4: Remove.
* m4/ulonglong.m4: Remove.
* m4/xstrtoumax.m4: Remove.
* src/system.h: Remove strerror, sys_nerr, sys_errlist.
|
|
|
|
|
|
|
|
|
|
| |
* lib/Makefile.am: Distribute gettext.h.
* lib/closeout.c: Use it.
* lib/gettext.h: New.
* lib/quotearg.c: Use it.
* lib/xmalloc.c: Use it.
* src/dfa.c: Use it.
* src/system.h: Use it.
|
| |
|
| |
|
|
|
|
|
| |
* 78 files: Update FSF's civic address, zip code,
and citizen relocation code.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
* lib/getpagesize.h (getpagesize): Define to B_PAGE_SIZE if
__BEOS__ is defined. Based on a fix by Bruno Haible
<haible@clisp.cons.org>.
|
|
|
|
|
| |
* src/system.h [BeOS]: Ignore O_BINARY.
* src/getpagesize.h [BeOS]: Define getpagesize() as B_PAGE_SIZE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
src/getpagesize.h src/grep.c src/kwset.c src/search.c
src/system.h src/vms_fab.c src/vms_fab.h vms/make.com
more support for VMS.
* doc/grep.1: corrected typo.
Noted by Ruslan Ermilob.
* vms/config_vms.h: New File, contains macros specific to VMS and
avoid namespace collision with operating system supplied C library.
* vms/make.com: Updated.
* src/getpagesize.h: New macros for VMS.
* src/vms_fab.c: Cast to some assigments.
* src/vms_fab.h: Added new include files.
Those patches were provided by zinser@decus.de (Martin).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
src/system.h
Support for general option --binary-file from David O'Brien.
Inititial patch from David O'Brien.
Add --binary-files option.
* NEWS, doc/grep.1, doc/grep.texi: Document it.
* src/grep.c (BINARY_FILES_OPTION): New constant.
(long_options, grep, usage, main): New --binary-files option.
(binary_files): New var.
* src/system.h (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, CHAR_MAX):
New macros.
(INT_MAX, UCHAR_MAX): Define in terms of TYPE_MAXIMUM.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
new set o patches from Paul
new set o patches from Paul
* NEWS, doc/grep.1, doc/grep.texi: New option --mmap.
* src/grep.c (mmap_option): New variable.
(long_options, reset, usage): Add --mmap.
Default is now read, not mmap.
* doc/grep.1: Document -Z or --null.
* doc/grep.texi: Fix texinfo glitches. POSIX -> POSIX.2 where
appropriate.
* doc/grep.texi: Fix texinfo glitches. POSIX -> POSIX.2 where
appropriate.
* acconfig.h (ssize_t): New #undef.
* configure.in (AC_CHECK_TYPE): Add ssize_t.
* src/grep.c (PREFERRED_SAVE_FACTOR): New macro.
(reset): If the buffer has already been allocated, set bufsalloc to
be bufalloc / PREFERRED_SAVE_FACTOR. This avoids problems when
bufsalloc == bufalloc (possible after reading a large binary file).
(reset): Use PREFERRED_SAVE_FACTOR instead of magic constant.
Do not set bufbeg; nobody uses it.
Always set buflim.
Check for lseek error.
Use SEEK_CUR, not a magic constant.
(fillbuf): Return an error indication, not a count.
All callers changed.
Do not assume ssize_t fits in int.
Use PREFERRED_SAVE_FACTOR instead of magic constant.
Clean up mmap code.
Do not attempt to mmap zero bytes.
Check for lseek error.
Use SEEK_SET, not a magic constant.
Work correctly if read is interrupted.
(grepfile): Work correctly if open or close is interrupted.
* src/system.h (SEEK_SET, SEEK_CUR): New macros.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
update form Paul on his previous patch.
* configure.in (AC_CHECK_FUNCS): Add memmove.
* src/system.h (S_ISREG): New macro.
(memmove): Define if ! defined HAVE_MEMMOVE && ! defined memmove,
not if !defined STDC_HEADERS. This is needed for SunOS 4.1.4,
which defines STDC_HEADERS but lacks memmove.
* src/grep.c (bufoffset): Needed even if !defined HAVE_MMAP.
(reset): Always fstat the file, since we always need its size if it is
regular.
Similarly, get the buffer offset of every regular file.
Set bufmapped to 0 if the file's initial offset is not a multiple
of the page size.
(fillbuf): Calculate an upper bound on how much memory we should
allocate only for regular files, since we don't know the sizes of
other files.
Don't bother to check whether the file offset is a multiple of the page
size, since we now do that just once in `reset'.
When an mmapped area would fall past the end of the file, trim it to
just before instead of giving up immediately and doing a `read';
that avoids a worst-case behavior that could read half an mmapped file.
Fix bug when computing offsets on hosts that don't have mmap.
|
|
|
|
| |
new scheme by Paul Eggert for buffer allocation.
|