blob: a07d535cf8c22a6805e58bea4c8e8f50b3cbb77e [file] [log] [blame]
Denys Vlasenko5707b522010-12-20 05:12:39 +01001/* vi: set sw=4 ts=4: */
2/*
3 * helper routines
4 *
5 * Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com>
6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */
Denis Vlasenko239d06b2008-11-06 23:42:42 +00009
10struct globals {
11 pid_t helper_pid;
12 unsigned timeout;
Denys Vlasenko5707b522010-12-20 05:12:39 +010013 unsigned verbose;
Denis Vlasenko239d06b2008-11-06 23:42:42 +000014 char *user;
15 char *pass;
16 FILE *fp0; // initial stdin
17 char *opt_charset;
Denis Vlasenko239d06b2008-11-06 23:42:42 +000018};
19
20#define G (*ptr_to_globals)
Denis Vlasenko239d06b2008-11-06 23:42:42 +000021#define INIT_G() do { \
22 SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
23 G.opt_charset = (char *)CONFIG_FEATURE_MIME_CHARSET; \
Denis Vlasenko239d06b2008-11-06 23:42:42 +000024} while (0)
25
26//char FAST_FUNC *parse_url(char *url, char **user, char **pass);
27
Denys Vlasenko5707b522010-12-20 05:12:39 +010028void launch_helper(const char **argv) FAST_FUNC;
29void get_cred_or_die(int fd) FAST_FUNC;
Denis Vlasenko239d06b2008-11-06 23:42:42 +000030
Denys Vlasenkob6237c02020-12-17 12:34:25 +010031void send_r_n(const char *s) FAST_FUNC;
Denys Vlasenko5707b522010-12-20 05:12:39 +010032char *send_mail_command(const char *fmt, const char *param) FAST_FUNC;
Denis Vlasenko239d06b2008-11-06 23:42:42 +000033
Denys Vlasenko8d634a02018-07-31 17:30:08 +020034void printbuf_base64(const char *buf, unsigned len) FAST_FUNC;
35void printstr_base64(const char *buf) FAST_FUNC;
36void printfile_base64(const char *fname) FAST_FUNC;