diff options
| author | Jakob Kaivo <jkk@ung.org> | 2022-04-21 09:34:15 -0400 |
|---|---|---|
| committer | Jakob Kaivo <jkk@ung.org> | 2022-04-21 09:34:15 -0400 |
| commit | 7e965cba479cd560600bbb68bd1be0c619da9541 (patch) | |
| tree | aad48d657db624255f6ad67dd88f23d8129f5685 | |
| parent | a2d6323436f4d80fbd3f7d80b7d839ba247076a2 (diff) | |
implement -x for -F
| -rw-r--r-- | grep.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -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; } |
