65 #define STR(x) vstring_str(x)
69 static const char *dict_pipe_lookup(
DICT *dict,
const char *query)
71 static const char myname[] =
"dict_pipe_lookup";
76 const char *result = 0;
79 for (cpp = dict_pipe->
map_pipe->
argv; (dict_type_name = *cpp) != 0; cpp++) {
81 msg_panic(
"%s: dictionary \"%s\" not found", myname, dict_type_name);
91 static void dict_pipe_close(
DICT *dict)
97 for (cpp = dict_pipe->
map_pipe->
argv; (dict_type_name = *cpp) != 0; cpp++)
108 static const char myname[] =
"dict_pipe_open";
110 char *saved_name = 0;
111 char *dict_type_name;
122 #define DICT_PIPE_RETURN(x) do { \
123 if (saved_name != 0) \
124 myfree(saved_name); \
133 if (open_flags != O_RDONLY)
135 open_flags, dict_flags,
136 "%s:%s map requires O_RDONLY access mode",
143 || *(saved_name =
mystrndup(name + 1, len - 2)) == 0
147 open_flags, dict_flags,
148 "bad syntax: \"%s:%s\"; "
149 "need \"%s:{type:name...}\"",
158 for (cpp = argv->
argv; (dict_type_name = *cpp) != 0; cpp++) {
160 msg_info(
"%s: %s", myname, dict_type_name);
161 if (strchr(dict_type_name,
':') == 0)
163 open_flags, dict_flags,
164 "bad syntax: \"%s:%s\"; "
165 "need \"%s:{type:name...}\"",
169 dict =
dict_open(dict_type_name, open_flags, dict_flags);
172 if (cpp == argv->
argv)
183 dict_pipe->
dict.
flags = dict_flags | match_flags;
void dict_register(const char *dict_name, DICT *dict_info)
#define DICT_OWNER_AGGREGATE_UPDATE(dst, src)
ARGV * argv_free(ARGV *argvp)
void(* close)(struct DICT *)
NORETURN msg_panic(const char *fmt,...)
#define DICT_OWNER_AGGREGATE_INIT(dst)
DICT * dict_open(const char *, int, int)
void dict_unregister(const char *dict_name)
VSTRING * vstring_strcpy(VSTRING *vp, const char *src)
DICT * dict_pipe_open(const char *name, int open_flags, int dict_flags)
ARGV * argv_splitq(const char *, const char *, const char *)
#define dict_get(dp, key)
DICT * dict_handle(const char *dict_name)
VSTRING * vstring_alloc(ssize_t len)
const char *(* lookup)(struct DICT *, const char *)
#define DICT_ERR_VAL_RETURN(dict, err, val)
#define DICT_FLAG_PATTERN
char * mystrndup(const char *str, ssize_t len)
size_t balpar(const char *string, const char *parens)
VSTRING * vstring_free(VSTRING *vp)
DICT * dict_alloc(const char *, const char *, ssize_t)
DICT * dict_surrogate(const char *dict_type, const char *dict_name, int open_flags, int dict_flags, const char *fmt,...)
#define DICT_PIPE_RETURN(x)
void msg_info(const char *fmt,...)