On Thursday 20 October 2005 04:57 pm, Parv wrote:
> in message <[EMAIL PROTECTED]>,
> wrote James Long thusly...
>
> > Should these two commands produce identical output?
> >
> > $ bzegrep "38436|41640" /var/log/maillog.0.bz2 | wc -l
> >        0
> > $ bzcat /var/log/maillog.0.bz2 | egrep "38436|41640" | wc -l
> >      121

Can you try the patch for src/gnu/usr.bin/grep/grep.c?

> And more fun, try also "egrep -J| wc", which is similar to the 2d
> case above.

Can you elaborate the fun, please?

Thanks,

JK

> Seems like the first "e" in "bzegrep" is erroneous.
>   - Parv
Index: grep.c
===================================================================
RCS file: /home/ncvs/src/gnu/usr.bin/grep/grep.c,v
retrieving revision 1.31
diff -u -r1.31 grep.c
--- grep.c	14 May 2005 05:35:04 -0000	1.31
+++ grep.c	20 Oct 2005 20:55:05 -0000
@@ -1359,16 +1359,16 @@
   if (program_name && strrchr (program_name, '/'))
     program_name = strrchr (program_name, '/') + 1;
 
+  if (strlen (program_name) > 1 && program_name[0] == 'b' && program_name[1] == 'z') {
+    BZflag = 1;
+    program_name += 2;
+  }
 #if HAVE_LIBZ > 0
-  if (program_name[0] == 'z') {
+  else if (strlen (program_name) > 0 && program_name[0] == 'z') {
     Zflag = 1;
     ++program_name;
   }
 #endif
-  if (program_name[0] == 'b') {
-    BZflag = 1;
-    ++program_name;
-  }
 
 #if defined(__MSDOS__) || defined(_WIN32)
   /* DOS and MS-Windows use backslashes as directory separators, and usually
_______________________________________________
freebsd-stable@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to