}
}
-static int
+int
mangle_pat(tchar *pat, const tchar *path, unsigned long line_no)
{
- /* Remove quotes */
- if (pat[0] == T('"') || pat[0] == T('\'')) {
- tchar quote = pat[0];
- tchar *last = pat + tstrlen(pat) - 1;
- if (last > pat && *last == quote) {
- tmemmove(pat, pat + 1, last - (pat + 1));
- *(last - 1) = T('\0');
- }
- }
-
if (!is_any_path_separator(pat[0]) &&
pat[0] != T('\0') && pat[1] == T(':'))
{
}
int
-do_read_capture_config_file(const tchar *config_file, tchar *buf, size_t buflen,
- struct capture_config *config)
+do_read_capture_config_file(const tchar *config_file, const void *buf,
+ size_t bufsize, struct capture_config *config)
{
int ret;
+ STRING_SET(prepopulate_pats);
struct text_file_section sections[] = {
{T("ExclusionList"),
&config->exclusion_pats},
{T("ExclusionException"),
&config->exclusion_exception_pats},
+ {T("PrepopulateList"),
+ &prepopulate_pats},
};
+ void *mem;
- ret = do_load_text_file(config_file, buf, buflen, &buf,
- sections, ARRAY_LEN(sections), mangle_pat);
+ ret = do_load_text_file(config_file, buf, bufsize, &mem,
+ sections, ARRAY_LEN(sections),
+ LOAD_TEXT_FILE_REMOVE_QUOTES, mangle_pat);
if (ret)
return ret;
- config->buf = buf;
+ FREE(prepopulate_pats.strings);
+
+ config->buf = mem;
return 0;
}
FREE(config->buf);
}
-static bool
+bool
match_pattern(const tchar *path,
const tchar *path_basename,
const struct string_set *list)