112 #define MATCH_DICTIONARY(pattern) \
113 ((pattern)[0] != '[' && strchr((pattern), ':') != 0)
118 char *
string,
int init_match)
120 const char *myname =
"match_list_parse";
127 char *map_type_name_flags;
137 #define OPEN_FLAGS O_RDONLY
138 #define DICT_FLAGS (DICT_FLAG_LOCK | DICT_FLAG_UTF8_REQUEST)
139 #define STR(x) vstring_str(x)
150 msg_warn(
"%s: comment at end of line is not supported: %s %s",
151 match_list->
pname, start, bp);
154 for (match = init_match, item = start; *item ==
'!'; item++)
167 "open file %s: %m", item));
172 pat_list = match_list_parse(match_list, pat_list,
175 msg_fatal(
"%s: read file %s: %m", myname, item);
180 map_type_name_flags =
STR(buf) + (match == 0);
198 const char *patterns,
int match_count,...)
201 char *saved_patterns;
206 msg_panic(
"match_list_init: bad flags 0x%x", flags);
215 (
const char **)
mymalloc(match_count *
sizeof(
const char *));
216 va_start(ap, match_count);
217 for (i = 0; i < match_count; i++)
225 saved_patterns =
mystrdup(patterns);
237 const char *myname =
"match_list_match";
249 list->
match_args[i] = va_arg(ap,
const char *);
253 for (cpp = list->
patterns->
argv; (pat = *cpp) != 0; cpp++) {
254 for (match = 1; *pat ==
'!'; pat++)
260 else if (list->
error != 0)
#define vstring_fgets(s, p)
char * mystrdup(const char *str)
void dict_register(const char *dict_name, DICT *dict_info)
ARGV * argv_free(ARGV *argvp)
NORETURN msg_panic(const char *fmt,...)
void argv_add(ARGV *argvp,...)
char * mystrtokq(char **src, const char *sep, const char *parens)
DICT * dict_open(const char *, int, int)
ARGV * argv_alloc(ssize_t len)
VSTREAM * vstream_fopen(const char *path, int flags, mode_t mode)
#define casefold(dst, src)
int match_list_match(MATCH_LIST *list,...)
void match_list_free(MATCH_LIST *list)
MATCH_LIST * match_list_init(const char *pname, int flags, const char *patterns, int match_count,...)
int(* MATCH_LIST_FN)(MATCH_LIST *, const char *, const char *)
MATCH_LIST_FN * match_func
int vstream_fclose(VSTREAM *stream)
DICT * dict_handle(const char *dict_name)
void msg_warn(const char *fmt,...)
VSTRING * vstring_alloc(ssize_t len)
const char * dict_flags_str(int dict_flags)
VSTRING * vstring_sprintf(VSTRING *vp, const char *format,...)
NORETURN msg_fatal(const char *fmt,...)
VSTRING * vstring_free(VSTRING *vp)
#define MATCH_DICTIONARY(pattern)
DICT * dict_surrogate(const char *dict_type, const char *dict_name, int open_flags, int dict_flags, const char *fmt,...)
void * mymalloc(ssize_t len)
void argv_terminate(ARGV *argvp)
void msg_info(const char *fmt,...)