mirror of
https://github.com/0intro/wmii
synced 2024-11-25 15:20:15 +03:00
23 lines
380 B
C
23 lines
380 B
C
/* Copyright ©2008-2010 Kris Maglione <maglione.k at Gmail>
|
|
* See LICENSE file for license details.
|
|
*/
|
|
#include "util.h"
|
|
|
|
|
|
void
|
|
grep(char **list, Reprog *re, int flags) {
|
|
char **p, **q;
|
|
int res;
|
|
|
|
q = list;
|
|
for(p=q; *p; p++) {
|
|
res = 0;
|
|
if(re)
|
|
res = regexec(re, *p, nil, 0);
|
|
if(res && !(flags & GInvert)
|
|
|| !res && (flags & GInvert))
|
|
*q++ = *p;
|
|
}
|
|
*q = nil;
|
|
}
|