85 const char *myname =
"smtp_map11_internal";
90 if (new_addr->
argc > 1)
92 result = new_addr->
argv[0];
94 msg_info(
"%s: %s -> %s", myname,
STR(addr), result);
157 if ((at = strrchr(addr,
'@')) == 0
158 || (at + 1)[strcspn(at + 1,
"\"\\")] != 0)
163 static NORETURN usage(
const char *progname)
168 int main(
int argc,
char **argv)
190 while ((ch =
GETOPT(argc, argv,
"v")) > 0) {
208 #define UPDATE(var, val) do { myfree(var); var = mystrdup(val); } while (0)
228 msg_fatal(
"missing parameter for command %s", cmd);
233 if (strcmp(cmd,
"maps") == 0) {
245 else if (maps != 0 && (strcmp(cmd,
"external") == 0
246 || strcmp(cmd,
"internal") == 0
247 || strcmp(cmd,
"tree") == 0)) {
254 if ((addr_field =
mystrtok(&bp,
":")) == 0)
263 if (strcmp(cmd,
"external") == 0) {
266 }
else if (maps && strcmp(cmd,
"internal") == 0) {
269 }
else if (maps && strcmp(cmd,
"tree") == 0) {
276 for (tpp = addr_list; *tpp; tpp++)
278 myfree((
void *) addr_list);
288 cmd, addr_field, have_result ?
290 "(error)" :
"(no match)");
296 if (res_field && have_result) {
297 if (strcmp(res_field,
STR(addr_buf)) != 0) {
298 msg_warn(
"expect result '%s' but got '%s'",
299 res_field,
STR(addr_buf));
302 }
else if (res_field && !have_result) {
303 msg_warn(
"expect result '%s' but got none", res_field);
305 }
else if (!res_field && have_result) {
306 msg_warn(
"expected no result but got '%s'",
STR(addr_buf));
ARGV * argv_free(ARGV *argvp)
TOK822 ** tok822_grep(TOK822 *, int)
#define tok822_scan(cp, ptr)
int main(int argc, char **argv)
#define mail_addr_map_internal(path, address, propagate)
VSTRING * unquote_822_local(VSTRING *dst, const char *mbox)
#define DICT_FLAG_UTF8_REQUEST
char * mystrtok(char **src, const char *sep)
#define DICT_FLAG_FOLD_FIX
VSTRING * vstring_strcpy(VSTRING *vp, const char *src)
TOK822 * tok822_free_tree(TOK822 *)
VSTRING * vstring_sprintf_append(VSTRING *vp, const char *format,...)
MAPS * maps_create(const char *title, const char *map_names, int dict_flags)
VSTRING * canon_addr_external(VSTRING *result, const char *addr)
VSTREAM * vstream_printf(const char *fmt,...)
void msg_warn(const char *fmt,...)
VSTRING * vstring_alloc(ssize_t len)
VSTRING * tok822_externalize(VSTRING *, TOK822 *, int)
VSTRING * tok822_internalize(VSTRING *, TOK822 *, int)
NORETURN msg_fatal(const char *fmt,...)
MAPS * maps_free(MAPS *maps)
VSTRING * readllines(VSTRING *buf, VSTREAM *fp, int *lineno, int *first_line)
int vstream_fflush(VSTREAM *stream)
int smtp_map11_external(VSTRING *addr, MAPS *maps, int propagate)
#define GETOPT(argc, argv, str)
#define quote_822_local(dst, src)
VSTRING * vstring_free(VSTRING *vp)
void msg_vstream_init(const char *name, VSTREAM *vp)
int smtp_map11_internal(VSTRING *addr, MAPS *maps, int propagate)
int smtp_map11_tree(TOK822 *tree, MAPS *maps, int propagate)
void msg_info(const char *fmt,...)