grep: default REG_NOSUB

This commit is contained in:
Connor Lane Smith 2011-05-29 20:38:15 +01:00
parent 04bac53826
commit 6427386b02

4
grep.c
View File

@ -18,7 +18,7 @@ int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
char c; char c;
int flags = 0; int flags = REG_NOSUB;
regex_t preg; regex_t preg;
FILE *fp; FILE *fp;
@ -43,8 +43,6 @@ main(int argc, char *argv[])
fprintf(stderr, "usage: %s [-cilnqv] pattern [files...]\n", argv[0]); fprintf(stderr, "usage: %s [-cilnqv] pattern [files...]\n", argv[0]);
exit(2); exit(2);
} }
if(mode == 'c')
flags |= REG_NOSUB;
if(iflag) if(iflag)
flags |= REG_ICASE; flags |= REG_ICASE;
regcomp(&preg, argv[optind++], flags); regcomp(&preg, argv[optind++], flags);