Merge changes from 2.5.1 import.

This commit is contained in:
wiz 2003-02-13 07:48:11 +00:00
parent 930075e3a9
commit 8e9c96bbc4
2 changed files with 9 additions and 2 deletions

1
gnu/dist/grep/intl/VERSION vendored Normal file
View File

@ -0,0 +1 @@
GNU gettext library from gettext-0.10.35

View File

@ -1,4 +1,4 @@
/* $NetBSD: grep.c,v 1.9 2003/01/26 23:38:52 wiz Exp $ */
/* $NetBSD: grep.c,v 1.10 2003/02/13 07:48:12 wiz Exp $ */
/* grep.c - main driver file for grep.
Copyright 1992, 1997-1999, 2000 Free Software Foundation, Inc.
@ -541,6 +541,8 @@ prline (char const *beg, char const *lim, int sep)
char const *b = beg + match_offset;
if (b == lim)
break;
if (match_size == 0)
break;
if(color_option)
printf("\33[%sm", grep_color);
fwrite(b, sizeof (char), match_size, stdout);
@ -585,13 +587,16 @@ prline (char const *beg, char const *lim, int sep)
lastout = lim;
return;
}
while ((match_offset = (*execute) (beg, lim - beg, &match_size, 1))
while (lim-beg && (match_offset = (*execute) (beg, lim - beg, &match_size, 1))
!= (size_t) -1)
{
char const *b = beg + match_offset;
/* Avoid matching the empty line at the end of the buffer. */
if (b == lim)
break;
/* Avoid hanging on grep --color "" foo */
if (match_size == 0)
break;
fwrite (beg, sizeof (char), match_offset, stdout);
printf ("\33[%sm", grep_color);
fwrite (b, sizeof (char), match_size, stdout);
@ -1524,6 +1529,7 @@ main (int argc, char **argv)
case 'q':
exit_on_match = 1;
close_stdout_set_status(0);
break;
case 'R':