blob: d1d783055a3b703b84d6e7fdacfc19ec14c190b4 [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 unsigned opts;
15 char *user;
16 char *pass;
17 FILE *fp0; // initial stdin
18 char *opt_charset;
19 char *content_type;
20};
21
22#define G (*ptr_to_globals)
23#define timeout (G.timeout )
Denys Vlasenko5707b522010-12-20 05:12:39 +010024#define verbose (G.verbose )
Denis Vlasenko239d06b2008-11-06 23:42:42 +000025#define opts (G.opts )
26//#define user (G.user )
27//#define pass (G.pass )
28//#define fp0 (G.fp0 )
29//#define opt_charset (G.opt_charset)
30//#define content_type (G.content_type)
31#define INIT_G() do { \
32 SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \
33 G.opt_charset = (char *)CONFIG_FEATURE_MIME_CHARSET; \
34 G.content_type = (char *)"text/plain"; \
35} while (0)
36
37//char FAST_FUNC *parse_url(char *url, char **user, char **pass);
38
Denys Vlasenko5707b522010-12-20 05:12:39 +010039void launch_helper(const char **argv) FAST_FUNC;
40void get_cred_or_die(int fd) FAST_FUNC;
Denis Vlasenko239d06b2008-11-06 23:42:42 +000041
Denys Vlasenko5707b522010-12-20 05:12:39 +010042char *send_mail_command(const char *fmt, const char *param) FAST_FUNC;
Denis Vlasenko239d06b2008-11-06 23:42:42 +000043
Denys Vlasenko5707b522010-12-20 05:12:39 +010044void encode_base64(char *fname, const char *text, const char *eol) FAST_FUNC;