From: markus schnalke Date: Sat, 4 Feb 2012 09:51:26 +0000 (+0100) Subject: Refactoring in spost. X-Git-Tag: mmh-thesis-end~372 X-Git-Url: http://git.marmaro.de/?a=commitdiff_plain;h=6a7760a0fa8ccb36a056a7600aab31f3656f7cfa;p=mmh Refactoring in spost. --- diff --git a/uip/spost.c b/uip/spost.c index 8fc2f21..e3cf211 100644 --- a/uip/spost.c +++ b/uip/spost.c @@ -137,8 +137,6 @@ static enum { static char tmpfil[] = "/tmp/pstXXXXXX"; -static char from[BUFSIZ]; /* my network address */ -static char signature[BUFSIZ]; /* my signature */ static char *filter = NULL; /* the filter for BCC'ing */ static char *subject = NULL; /* the subject field for BCC'ing */ static char *fccfold[FCCS]; /* foldernames for FCC'ing */ @@ -159,7 +157,6 @@ extern char *getusername(void); ** static prototypes */ static void putfmt(char *, char *, FILE *); -static void start_headers(void); static void finish_headers(FILE *); static int get_header(char *, struct headers *); static void putadr(char *, struct mailname *); @@ -291,7 +288,6 @@ main(int argc, char **argv) if ((in = fopen(msg, "r")) == NULL) adios(msg, "unable to open"); - start_headers(); if (debug) { verbose++; out = stdout; @@ -524,12 +520,19 @@ putfmt(char *name, char *str, FILE *out) /* -** Construct signature name +** Add yet missing headers. */ static void -start_headers(void) +finish_headers(FILE *out) { char *cp; + char from[BUFSIZ]; /* my network address */ + char signature[BUFSIZ]; /* my signature */ + char *resentstr = (msgstate == resent) ? "Resent-" : ""; + + if (!(msgflags & MDAT)) { + fprintf(out, "%sDate: %s\n", resentstr, dtimenow(0)); + } strncpy(from, getusername(), sizeof(from)); if ((cp = getfullname()) && *cp) { @@ -537,24 +540,10 @@ start_headers(void) } else { snprintf(signature, sizeof(signature), "%s", from); } -} - - -/* -** Add yet missing headers. -*/ -static void -finish_headers(FILE *out) -{ - char *resentstr = (msgstate == resent) ? "Resent-" : ""; - - if (!(msgflags & MDAT)) { - fprintf(out, "%sDate: %s\n", resentstr, dtimenow(0)); - } if (!(msgflags & MFRM)) { fprintf(out, "%sFrom: %s\n", resentstr, signature); } else { - /* Add a Sender: header in case the From: header is fake. */ + /* In case the From: header contains multiple addresses. */ fprintf(out, "%sSender: %s\n", resentstr, from); } #ifdef notdef