Denys Vlasenko | 5707b52 | 2010-12-20 05:12:39 +0100 | [diff] [blame] | 1 | /* 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 Vlasenko | 239d06b | 2008-11-06 23:42:42 +0000 | [diff] [blame] | 9 | |
| 10 | struct globals { |
| 11 | pid_t helper_pid; |
| 12 | unsigned timeout; |
Denys Vlasenko | 5707b52 | 2010-12-20 05:12:39 +0100 | [diff] [blame] | 13 | unsigned verbose; |
Denis Vlasenko | 239d06b | 2008-11-06 23:42:42 +0000 | [diff] [blame] | 14 | 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 Vlasenko | 5707b52 | 2010-12-20 05:12:39 +0100 | [diff] [blame] | 24 | #define verbose (G.verbose ) |
Denis Vlasenko | 239d06b | 2008-11-06 23:42:42 +0000 | [diff] [blame] | 25 | #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 Vlasenko | 5707b52 | 2010-12-20 05:12:39 +0100 | [diff] [blame] | 39 | void launch_helper(const char **argv) FAST_FUNC; |
| 40 | void get_cred_or_die(int fd) FAST_FUNC; |
Denis Vlasenko | 239d06b | 2008-11-06 23:42:42 +0000 | [diff] [blame] | 41 | |
Denys Vlasenko | 5707b52 | 2010-12-20 05:12:39 +0100 | [diff] [blame] | 42 | char *send_mail_command(const char *fmt, const char *param) FAST_FUNC; |
Denis Vlasenko | 239d06b | 2008-11-06 23:42:42 +0000 | [diff] [blame] | 43 | |
Denys Vlasenko | 5707b52 | 2010-12-20 05:12:39 +0100 | [diff] [blame] | 44 | void encode_base64(char *fname, const char *text, const char *eol) FAST_FUNC; |