summaryrefslogtreecommitdiffstats
path: root/gnu
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2005-10-20 21:50:44 +0000
committerjkim <jkim@FreeBSD.org>2005-10-20 21:50:44 +0000
commit96a31315307517f15ef5537afa8b7a5d17958fa7 (patch)
treefc54545f79099a03f80db93088d2106f571fa01c /gnu
parentf604e28c4e366f3cc9dd5d9ffdca7f5d5dcb5007 (diff)
downloadFreeBSD-src-96a31315307517f15ef5537afa8b7a5d17958fa7.zip
FreeBSD-src-96a31315307517f15ef5537afa8b7a5d17958fa7.tar.gz
Fix a longstanding buglet in bz-prefixed grep(1).
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/grep/grep.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/gnu/usr.bin/grep/grep.c b/gnu/usr.bin/grep/grep.c
index 04a1667..ca47a49 100644
--- a/gnu/usr.bin/grep/grep.c
+++ b/gnu/usr.bin/grep/grep.c
@@ -1359,16 +1359,16 @@ main (int argc, char **argv)
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
OpenPOWER on IntegriCloud