[hackers] [sbase] If we have a match any pattern also match against blank lines || sin

From: <git_AT_suckless.org>
Date: Thu, 20 Nov 2014 19:20:15 +0100

commit b6a41b688b7f634f527d52022b377c6863f2a88a
Author: sin <sin_AT_2f30.org>
Date: Thu Nov 20 18:19:36 2014 +0000

    If we have a match any pattern also match against blank lines

diff --git a/grep.c b/grep.c
index 1c28928..c6dcbf6 100644
--- a/grep.c
+++ b/grep.c
_AT_@ -196,7 +196,7 @@ grep(FILE *fp, const char *str)
                         buf[len - 1] = '\0';
                 SLIST_FOREACH(pnode, &phead, entry) {
                         if (!Fflag) {
- if (regexec(&pnode->preg, buf, 0, NULL, 0) ^ vflag)
+ if (regexec(&pnode->preg, buf[0] == '\0' ? "\n" : buf, 0, NULL, 0) ^ vflag)
                                         continue;
                         } else {
                                 if (!xflag) {
Received on Thu Nov 20 2014 - 19:20:15 CET

This archive was generated by hypermail 2.3.0 : Thu Nov 20 2014 - 19:24:09 CET