CVS commit: src/usr.bin/grep

2024-08-13 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug 14 04:59:51 UTC 2024

Modified Files:
src/usr.bin/grep: file.c

Log Message:
grep: grep_refill: Fix -Wunused-variable for WITHOUT_GZIP

NFC otherwise.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/grep/file.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.bin/grep

2024-08-13 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug 14 04:59:51 UTC 2024

Modified Files:
src/usr.bin/grep: file.c

Log Message:
grep: grep_refill: Fix -Wunused-variable for WITHOUT_GZIP

NFC otherwise.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.bin/grep/file.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/grep/file.c
diff -u src/usr.bin/grep/file.c:1.11 src/usr.bin/grep/file.c:1.12
--- src/usr.bin/grep/file.c:1.11	Fri Apr  5 13:34:41 2019
+++ src/usr.bin/grep/file.c	Wed Aug 14 04:59:51 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: file.c,v 1.11 2019/04/05 13:34:41 christos Exp $	*/
+/*	$NetBSD: file.c,v 1.12 2024/08/14 04:59:51 rin Exp $	*/
 /*	$FreeBSD: head/usr.bin/grep/file.c 211496 2010-08-19 09:28:59Z des $	*/
 /*	$OpenBSD: file.c,v 1.11 2010/07/02 20:48:48 nicm Exp $	*/
 
@@ -35,7 +35,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: file.c,v 1.11 2019/04/05 13:34:41 christos Exp $");
+__RCSID("$NetBSD: file.c,v 1.12 2024/08/14 04:59:51 rin Exp $");
 
 #include 
 #include 
@@ -74,7 +74,9 @@ static inline int
 grep_refill(struct file *f)
 {
 	ssize_t nr = -1;
+#ifndef WITHOUT_GZIP
 	int bzerr;
+#endif
 
 	bufpos = buffer;
 	bufrem = 0;



CVS commit: src/usr.bin/grep

2024-08-13 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug 14 05:02:19 UTC 2024

Modified Files:
src/usr.bin/grep: file.c

Log Message:
grep: grep_refill: Fix previous; WITHOUT_BZ2 not WITHOUT_GZIP


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/grep/file.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/grep/file.c
diff -u src/usr.bin/grep/file.c:1.12 src/usr.bin/grep/file.c:1.13
--- src/usr.bin/grep/file.c:1.12	Wed Aug 14 04:59:51 2024
+++ src/usr.bin/grep/file.c	Wed Aug 14 05:02:19 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: file.c,v 1.12 2024/08/14 04:59:51 rin Exp $	*/
+/*	$NetBSD: file.c,v 1.13 2024/08/14 05:02:19 rin Exp $	*/
 /*	$FreeBSD: head/usr.bin/grep/file.c 211496 2010-08-19 09:28:59Z des $	*/
 /*	$OpenBSD: file.c,v 1.11 2010/07/02 20:48:48 nicm Exp $	*/
 
@@ -35,7 +35,7 @@
 #endif
 
 #include 
-__RCSID("$NetBSD: file.c,v 1.12 2024/08/14 04:59:51 rin Exp $");
+__RCSID("$NetBSD: file.c,v 1.13 2024/08/14 05:02:19 rin Exp $");
 
 #include 
 #include 
@@ -74,7 +74,7 @@ static inline int
 grep_refill(struct file *f)
 {
 	ssize_t nr = -1;
-#ifndef WITHOUT_GZIP
+#ifndef WITHOUT_BZ2
 	int bzerr;
 #endif
 



CVS commit: src/usr.bin/grep

2024-08-13 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Aug 14 05:02:19 UTC 2024

Modified Files:
src/usr.bin/grep: file.c

Log Message:
grep: grep_refill: Fix previous; WITHOUT_BZ2 not WITHOUT_GZIP


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.bin/grep/file.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



Re: CVS commit: src/usr.bin/grep

2011-02-16 Thread enami tsugutomo
Joerg Sonnenberger  writes:

> Module Name:  src
> Committed By: joerg
> Date: Wed Feb 16 01:31:34 UTC 2011
> 
> Modified Files:
>   src/usr.bin/grep: Makefile file.c grep.1 grep.c grep.h queue.c util.c
> Added Files:
>   src/usr.bin/grep: fastgrep.c

I just did `more fastgrep.c' and found following piece of code.  The
usage of wflag is an obvious regression from OpenBSD code.

|   if (fg->len >= 14 &&
|   strncmp(pat + (fg->bol ? 1 : 0), "[[:<:]]", 7) == 0 &&
|   strncmp(pat + (fg->bol ? 1 : 0) + fg->len - 7, "[[:>:]]", 7) == 0) {
|   fg->len -= 14;
|   /* Word boundary is handled separately in util.c */
|   wflag = true;
|   }
|
|   /*
|* Copy pattern minus '^' and '$' characters as well as word
|* match character classes at the beginning and ending of the
|* string respectively.
|*/
|   fg->pattern = grep_malloc(fg->len + 1);
|   strlcpy((char *)fg->pattern, pat + (bol ? 1 : 0) + wflag,
|   fg->len + 1);

enami.


Re: CVS commit: src/usr.bin/grep

2011-02-16 Thread Joerg Sonnenberger
On Thu, Feb 17, 2011 at 12:06:30PM +0900, enami tsugutomo wrote:
> Joerg Sonnenberger  writes:
> 
> > Module Name:src
> > Committed By:   joerg
> > Date:   Wed Feb 16 01:31:34 UTC 2011
> > 
> > Modified Files:
> > src/usr.bin/grep: Makefile file.c grep.1 grep.c grep.h queue.c util.c
> > Added Files:
> > src/usr.bin/grep: fastgrep.c
> 
> I just did `more fastgrep.c' and found following piece of code.  The
> usage of wflag is an obvious regression from OpenBSD code.

In which sense?

Joerg


Re: CVS commit: src/usr.bin/grep

2011-02-16 Thread enami tsugutomo
> In which sense?

The meaning of `... + wflag' was to skip 7 chars.

enami.


Re: CVS commit: src/usr.bin/grep

2011-02-17 Thread David Laight
On Thu, Feb 17, 2011 at 12:06:30PM +0900, enami tsugutomo wrote:
> 
> I just did `more fastgrep.c' and found following piece of code.  The
> usage of wflag is an obvious regression from OpenBSD code.
> 
> | if (fg->len >= 14 &&
> | strncmp(pat + (fg->bol ? 1 : 0), "[[:<:]]", 7) == 0 &&
> | strncmp(pat + (fg->bol ? 1 : 0) + fg->len - 7, "[[:>:]]", 7) == 0) {
> | fg->len -= 14;
> | /* Word boundary is handled separately in util.c */
> | wflag = true;
> | }

It looks like that might transform:
grep '[[:<:]]foo.*bar[[:>:]]'
to
grep -w 'foo.*bar'

which isn't a valid transform.
(I presume something else translated the original '\' ...)

I've known grep where searches for '\' were a lot faster than
using -w. Presumably because -w locates the words (start and end)
rather than just the start!

David

-- 
David Laight: da...@l8s.co.uk