summaryrefslogtreecommitdiffstats
path: root/gnu
diff options
context:
space:
mode:
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