-/* $OpenBSD: grep.c,v 1.48 2014/12/01 06:36:04 deraadt Exp $ */
+/* $OpenBSD: grep.c,v 1.49 2015/01/10 13:48:02 tedu Exp $ */
/*-
* Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
int Bflag; /* -B x: print x lines leading each match */
int Eflag; /* -E: interpret pattern as extended regexp */
int Fflag; /* -F: interpret pattern as list of fixed strings */
-int Gflag; /* -G: interpret pattern as basic regexp */
int Hflag; /* -H: always print filename header */
int Lflag; /* -L: only show names of files with no matches */
int Rflag; /* -R: recursively search directory trees */
SLIST_INIT(&patfilelh);
switch (__progname[0]) {
case 'e':
- Eflag++;
+ Eflag = 1;
break;
case 'f':
- Fflag++;
- break;
- case 'g':
- Gflag++;
+ Fflag = 1;
break;
#ifndef NOZ
case 'z':
- Zflag++;
+ Zflag = 1;
switch(__progname[1]) {
case 'e':
- Eflag++;
+ Eflag = 1;
break;
case 'f':
- Fflag++;
- break;
- case 'g':
- Gflag++;
+ Fflag = 1;
break;
}
break;
}
break;
case 'E':
- Fflag = Gflag = 0;
- Eflag++;
+ Fflag = 0;
+ Eflag = 1;
break;
case 'F':
- Eflag = Gflag = 0;
- Fflag++;
+ Eflag = 0;
+ Fflag = 1;
break;
case 'G':
Eflag = Fflag = 0;
- Gflag++;
break;
case 'H':
- Hflag++;
+ Hflag = 1;
break;
case 'I':
binbehave = BIN_FILE_SKIP;
break;
case 'R':
case 'r':
- Rflag++;
+ Rflag = 1;
break;
case 'U':
binbehave = BIN_FILE_BIN;
break;
#ifndef NOZ
case 'Z':
- Zflag++;
+ Zflag = 1;
break;
#endif
case 'a':
-/* $OpenBSD: grep.h,v 1.20 2014/12/01 06:36:04 deraadt Exp $ */
+/* $OpenBSD: grep.h,v 1.21 2015/01/10 13:48:02 tedu Exp $ */
/*-
* Copyright (c) 1999 James Howard and Dag-Erling Coïdan Smørgrav
extern int cflags, eflags;
/* Command line flags */
-extern int Aflag, Bflag, Eflag, Fflag, Gflag, Hflag, Lflag,
+extern int Aflag, Bflag, Eflag, Fflag, Hflag, Lflag,
Rflag, Zflag,
bflag, cflag, hflag, iflag, lflag, nflag, oflag, qflag, sflag,
vflag, wflag, xflag;