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 */ 9 10struct globals { 11 pid_t helper_pid; 12 unsigned timeout; 13 unsigned verbose; 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 ) 24#define verbose (G.verbose ) 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 39void launch_helper(const char **argv) FAST_FUNC; 40void get_cred_or_die(int fd) FAST_FUNC; 41 42char *send_mail_command(const char *fmt, const char *param) FAST_FUNC; 43 44void encode_base64(char *fname, const char *text, const char *eol) FAST_FUNC; 45