Patch from vodz to correct 'grep -e pattern1 -e pattern2' logic
This commit is contained in:
parent
f086ed8ddd
commit
7f164cd052
@ -20,8 +20,8 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* Jun 2003 by Vladimir Oleynik <dzo@simtreas.ru> -
|
* Apr 2004 by Vladimir Oleynik <dzo@simtreas.ru> -
|
||||||
* correction "-e pattern1 -e -e pattern2" logic and more optimizations.
|
* correction "-e pattern1 -e pattern2" logic and more optimizations.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -135,11 +135,9 @@ static int grep_file(FILE *file)
|
|||||||
*/
|
*/
|
||||||
regex_t regex;
|
regex_t regex;
|
||||||
xregcomp(®ex, pattern_ptr->data, reflags);
|
xregcomp(®ex, pattern_ptr->data, reflags);
|
||||||
ret = regexec(®ex, line, 0, NULL, 0) == 0;
|
ret |= regexec(®ex, line, 0, NULL, 0) == 0;
|
||||||
regfree(®ex);
|
regfree(®ex);
|
||||||
}
|
}
|
||||||
if (!ret)
|
|
||||||
break;
|
|
||||||
pattern_ptr = pattern_ptr->link;
|
pattern_ptr = pattern_ptr->link;
|
||||||
} /* while (pattern_ptr) */
|
} /* while (pattern_ptr) */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user