From: Frédéric Marchal Date: Fri, 6 Jan 2012 14:00:35 +0000 (+0000) Subject: Fix the formating of the e-mail subject X-Git-Tag: v2.3.3-pre1~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e023838406f13246e79e01667aac96176136cdd;p=thirdparty%2Fsarg.git Fix the formating of the e-mail subject The date in the subject line of the e-mail was produced with asctime. But that function append a \n at the end of the date. The subject line was therefore followed by a blank line as mailx was concerned and that would mess with the header of the e-mail. This patch render the subject line using strftime. It avoid the line break and allow mailx to add additional headers from the command line. --- diff --git a/email.c b/email.c index d034b77..cf3a38b 100644 --- a/email.c +++ b/email.c @@ -46,7 +46,7 @@ int geramail(const char *dirname, int debug, const char *outdir, const char *ema char strip1[MAXLEN], strip2[MAXLEN], strip3[MAXLEN], strip4[MAXLEN], strip5[MAXLEN], strip6[MAXLEN], strip7[MAXLEN]; char *buf; char warea[MAXLEN]; - char Subject[100]; + char Subject[120]; int totuser=0; time_t t; struct tm *local; @@ -273,8 +273,12 @@ int geramail(const char *dirname, int debug, const char *outdir, const char *ema while(fgets(warea,sizeof(warea),fp_top3)!=NULL) fputs(warea,stdout); } else { - snprintf(Subject,sizeof(Subject),_("SARG report, %s"),asctime(local)); + /* TRANSLATORS: The string is formatted using strftime. You can use + * any string formatting marker allowed by strftime. */ + strftime(Subject,sizeof(Subject),_("SARG report, %c"),local); snprintf(warea,sizeof(warea),"%s -s \"%s\" \"%s\" <\"%s\"",MailUtility,Subject,email,top3); + if (debug) + debuga(_("Sending mail with command: %s\n"),warea); cstatus=system(warea); if (!WIFEXITED(cstatus) || WEXITSTATUS(cstatus)) { debuga(_("command return status %d\n"),WEXITSTATUS(cstatus));