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; |
Denis Vlasenko | 239d06b | 2008-11-06 23:42:42 +0000 | [diff] [blame] | 19 | }; |
| 20 | |
| 21 | #define G (*ptr_to_globals) |
| 22 | #define timeout (G.timeout ) |
Denys Vlasenko | 5707b52 | 2010-12-20 05:12:39 +0100 | [diff] [blame] | 23 | #define verbose (G.verbose ) |
Denis Vlasenko | 239d06b | 2008-11-06 23:42:42 +0000 | [diff] [blame] | 24 | #define opts (G.opts ) |
Denis Vlasenko | 239d06b | 2008-11-06 23:42:42 +0000 | [diff] [blame] | 25 | #define INIT_G() do { \ |
| 26 | SET_PTR_TO_GLOBALS(xzalloc(sizeof(G))); \ |
| 27 | G.opt_charset = (char *)CONFIG_FEATURE_MIME_CHARSET; \ |
Denis Vlasenko | 239d06b | 2008-11-06 23:42:42 +0000 | [diff] [blame] | 28 | } while (0) |
| 29 | |
| 30 | //char FAST_FUNC *parse_url(char *url, char **user, char **pass); |
| 31 | |
Denys Vlasenko | 5707b52 | 2010-12-20 05:12:39 +0100 | [diff] [blame] | 32 | void launch_helper(const char **argv) FAST_FUNC; |
| 33 | void get_cred_or_die(int fd) FAST_FUNC; |
Denis Vlasenko | 239d06b | 2008-11-06 23:42:42 +0000 | [diff] [blame] | 34 | |
Denys Vlasenko | 5707b52 | 2010-12-20 05:12:39 +0100 | [diff] [blame] | 35 | char *send_mail_command(const char *fmt, const char *param) FAST_FUNC; |
Denis Vlasenko | 239d06b | 2008-11-06 23:42:42 +0000 | [diff] [blame] | 36 | |
Denys Vlasenko | 8d634a0 | 2018-07-31 17:30:08 +0200 | [diff] [blame] | 37 | void printbuf_base64(const char *buf, unsigned len) FAST_FUNC; |
| 38 | void printstr_base64(const char *buf) FAST_FUNC; |
| 39 | void printfile_base64(const char *fname) FAST_FUNC; |