summaryrefslogtreecommitdiff
path: root/grep.c
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2022-04-21 09:20:39 -0400
committerJakob Kaivo <jkk@ung.org>2022-04-21 09:20:39 -0400
commitdb7aadfa489566529abd3e9d330494b246be3797 (patch)
tree25336a625690fbb39dd9f5f82a19db0dd34e407f /grep.c
parente9366a5f43a9c5b5b16216646b67cccdf9cecf54 (diff)
implement -v
Diffstat (limited to 'grep.c')
-rw-r--r--grep.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/grep.c b/grep.c
index 10e1a16..344921f 100644
--- a/grep.c
+++ b/grep.c
@@ -42,9 +42,9 @@ struct grep_list {
enum { NORMAL, COUNT, LIST, QUIET } grep_display = NORMAL;
static int grep_filenames = 0;
static int grep_linenumbers = 0;
+static int grep_inverse = 0;
#define SUPPRESS 1 << 2
-#define INVERT 1 << 3
#define WHOLELINE 1 << 4
#define FILENAMES 1 << 5
@@ -59,11 +59,11 @@ static int grep_match(struct grep_list *head, const char *buf)
}
if (regexec(&(c->re), buf, 0, NULL, 0) == 0) {
- return 1;
+ return !grep_inverse;
}
}
- return 0;
+ return grep_inverse;
}
static uintmax_t grep(struct grep_list *head, const char *path, int flags)
@@ -220,7 +220,7 @@ int main(int argc, char *argv[])
break;
case 'v':
- //flags |= INVERT;
+ grep_inverse = 1;
break;
case 'x':