Date: Thu, 20 Oct 2005 17:11:44 -0400 From: Jung-uk Kim <jkim@FreeBSD.org> To: freebsd-stable@FreeBSD.org, f-q <freebsd-questions@FreeBSD.org> Cc: James Long <stable@museum.rain.com> Subject: Re: bzegrep behaviour not consistent with egrep? Message-ID: <200510201711.49382.jkim@FreeBSD.org> In-Reply-To: <20051020205704.GC4000@holestein.holy.cow> References: <20051020194725.GA10376@ns.museum.rain.com> <20051020205704.GC4000@holestein.holy.cow>
next in thread | previous in thread | raw e-mail | index | archive | help
--Boundary-00=_VgAWDoCKl2Bf8Kw Content-Type: text/plain; charset="euc-kr" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Thursday 20 October 2005 04:57 pm, Parv wrote: > in message <20051020194725.GA10376@ns.museum.rain.com>, > 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 --Boundary-00=_VgAWDoCKl2Bf8Kw Content-Type: text/x-diff; charset="euc-kr"; name="grep.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="grep.diff" 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 --Boundary-00=_VgAWDoCKl2Bf8Kw--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200510201711.49382.jkim>