summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--grep.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/grep.c b/grep.c
index 85a6d8f..73d9220 100644
--- a/grep.c
+++ b/grep.c
@@ -50,8 +50,11 @@ static int grep_match(struct grep_list *head, const char *buf)
{
for (struct grep_list *c = head; c != NULL; c = c->next) {
if (c->string) {
- if (strstr(buf, c->string)) {
- return 1;
+ if (grep_exact && strcmp(buf, c->string) == 0) {
+ return !grep_inverse;
+ }
+ if (!grep_exact && strstr(buf, c->string)) {
+ return !grep_inverse;
}
continue;
}