This commit was generated by cvs2svn to compensate for changes in r56230,

which included commits to RCS files with non-trunk default branches.
This commit is contained in:
Ruslan Ermilov 2000-01-18 09:45:11 +00:00
commit 5a5a4819e3
7 changed files with 69 additions and 22 deletions

View File

@ -1,3 +1,22 @@
2000-01-04 Paul Eggert
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.
2000-01-04 Paul Eggert
* savedir.c (savedir): Don't store past the end of an array if
name_size is zero and the directory is empty.
Reported by Dima Barsky <dima@pwd.hp.com>.
1999-11-18 Paul Eggert
* m4/largefile.m4 (AC_SYS_LARGEFILE_FLAGS): Work around a

View File

@ -1,3 +1,10 @@
- The new option --binary-files=TYPE makes grep assume that a binary input
file is of type TYPE.
--binary-files='binary' (the default) outputs a 1-line summary of matches.
--binary-files='without-match' assumes binary files do not match.
--binary-files='text' treats binary files as text
(equivalent to -a or --text).
Version 2.4:
- egrep is now equivalent to `grep -E' as required by POSIX,

View File

@ -4,6 +4,7 @@ Andreas Schwab <schwab@suse.de>
Andreas Ley <andy@rz.uni-karlsruhe.de>
Ben Elliston <bje@cygnus.com>
David J MacKenzie <djm@catapult.va.pubnix.com>
David O'Brien <obrien@freebsd.org>
Eli Zaretskii <eliz@is.elta.co.il>
Florian La Roche <florian@knorke.saar.de>
Franc,ois Pinard <pinard@IRO.UMontreal.CA>

View File

@ -275,6 +275,21 @@ This version number should be included in all bug reports.
Print a usage message briefly summarizing these command-line options
and the bug-reporting address, then exit.
@itemx --binary-files=@var{type}
@opindex --binary-files
@cindex binary files
If the first few bytes of a file indicate that the file contains binary
data, assume that the file is of type @var{type}. By default,
@var{type} is @samp{binary}, and @command{grep} normally outputs either
a one-line message saying that a binary file matches, or no message if
there is no match. If @var{type} is @samp{without-match},
@command{grep} assumes that a binary file does not match. If @var{type}
is @samp{text}, @command{grep} processes a binary file as if it were
text; this is equivalent to the @samp{-a} or @samp{--text} option.
@emph{Warning:} @samp{--binary-files=text} might output binary garbage,
which can have nasty side effects if the output is a terminal and if the
terminal driver interprets some of it as commands.
@item -b
@itemx --byte-offset
@opindex -b
@ -329,16 +344,8 @@ The scanning of every file will stop on the first match.
@opindex --text
@cindex suppress binary data
@cindex binary files
Do not suppress output lines that contain binary data.
Normally, if the first few bytes of a file indicate
that the file contains binary data, grep outputs only a
message saying that the file matches the pattern. This
option causes grep to act as if the file is a text
file, even if it would otherwise be treated as binary.
@emph{Warning:} the result might be binary garbage
printed to the terminal, which can have nasty
side-effects if the terminal driver interprets some of
it as commands.
Process a binary file as if it were text; this is equivalent to the
@samp{--binary-files=text} option.
@item -w
@itemx --word-regexp

View File

@ -1,3 +1,3 @@
@set UPDATED 13 November 1999
@set EDITION 2.4
@set VERSION 2.4
@set UPDATED 16 January 2000
@set EDITION 2.4a
@set VERSION 2.4a

View File

@ -1,5 +1,5 @@
/* savedir.c -- save the list of files in a directory in a string
Copyright (C) 1990, 1997, 1998 Free Software Foundation, Inc.
Copyright (C) 1990, 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -89,6 +89,10 @@ savedir (dir, name_size)
if (dirp == NULL)
return NULL;
/* Be sure name_size is at least `1' so there's room for
the final NUL byte. */
name_size += !name_size;
name_space = (char *) malloc (name_size);
if (name_space == NULL)
{

View File

@ -127,11 +127,20 @@ void free();
#ifndef CHAR_BIT
# define CHAR_BIT 8
#endif
/* The extra casts work around common compiler bugs. */
#define TYPE_SIGNED(t) (! ((t) 0 < (t) -1))
#define TYPE_MINIMUM(t) ((t) (TYPE_SIGNED (t) \
? ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1) \
: (t) 0))
#define TYPE_MAXIMUM(t) ((t) (~ (t) 0 - TYPE_MINIMUM (t)))
#ifndef CHAR_MAX
# define CHAR_MAX TYPE_MAXIMUM (char)
#endif
#ifndef INT_MAX
# define INT_MAX 2147483647
# define INT_MAX TYPE_MAXIMUM (int)
#endif
#ifndef UCHAR_MAX
# define UCHAR_MAX 255
# define UCHAR_MAX TYPE_MAXIMUM (unsigned char)
#endif
#if !defined(STDC_HEADERS) && defined(HAVE_STRING_H) && defined(HAVE_MEMORY_H)