summaryrefslogtreecommitdiffstats
path: root/lib/utils_disk.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils_disk.c')
-rw-r--r--lib/utils_disk.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/utils_disk.c b/lib/utils_disk.c
index ce02fdff..34401e21 100644
--- a/lib/utils_disk.c
+++ b/lib/utils_disk.c
@@ -29,6 +29,7 @@
29#include "common.h" 29#include "common.h"
30#include "utils_disk.h" 30#include "utils_disk.h"
31#include "gl/fsusage.h" 31#include "gl/fsusage.h"
32#include <string.h>
32 33
33void 34void
34np_add_name (struct name_list **list, const char *name) 35np_add_name (struct name_list **list, const char *name)
@@ -207,6 +208,30 @@ np_find_name (struct name_list *list, const char *name)
207 return FALSE; 208 return FALSE;
208} 209}
209 210
211/* Returns TRUE if name is in list */
212bool
213np_find_regmatch (struct regex_list *list, const char *name)
214{
215 int len;
216 regmatch_t m;
217
218 if (name == NULL) {
219 return false;
220 }
221
222 len = strlen(name);
223
224 for (; list; list = list->next) {
225 /* Emulate a full match as if surrounded with ^( )$
226 by checking whether the match spans the whole name */
227 if (!regexec(&list->regex, name, 1, &m, 0) && m.rm_so == 0 && m.rm_eo == len) {
228 return true;
229 }
230 }
231
232 return false;
233}
234
210int 235int
211np_seen_name(struct name_list *list, const char *name) 236np_seen_name(struct name_list *list, const char *name)
212{ 237{