sbase

suckless unix tools
git clone git://git.2f30.org/sbase
Log | Files | Refs | README | LICENSE

commit de221bc6f582625f395fe44e3c3e3bfdb1b71bfa
parent 763409841f36041e3c143f949919d0adaf83c5bc
Author: Connor Lane Smith <cls@lubutu.com>
Date:   Sat,  4 Jun 2011 12:00:23 +0100

grep: cleanup
Diffstat:
Mgrep.c | 12+++---------
1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/grep.c b/grep.c @@ -8,8 +8,6 @@ static void grep(FILE *, const char *, regex_t *); -static bool Eflag = false; -static bool iflag = false; static bool vflag = false; static bool many; static bool match = false; @@ -26,7 +24,7 @@ main(int argc, char *argv[]) while((c = getopt(argc, argv, "Ecilnqv")) != -1) switch(c) { case 'E': - Eflag = true; + flags |= REG_EXTENDED; break; case 'c': case 'l': @@ -35,7 +33,7 @@ main(int argc, char *argv[]) mode = c; break; case 'i': - iflag = true; + flags |= REG_ICASE; break; case 'v': vflag = true; @@ -44,13 +42,9 @@ main(int argc, char *argv[]) exit(2); } if(optind == argc) { - fprintf(stderr, "usage: %s [-cilnqv] pattern [files...]\n", argv[0]); + fprintf(stderr, "usage: %s [-Ecilnqv] pattern [files...]\n", argv[0]); exit(2); } - if(Eflag) - flags |= REG_EXTENDED; - if(iflag) - flags |= REG_ICASE; regcomp(&preg, argv[optind++], flags); many = (argc > optind+1);