From 719c1a8da488bff55e7acf44bb85624df745a991 Mon Sep 17 00:00:00 2001 From: Ali Gholami Rudi Date: Tue, 31 May 2011 15:03:07 +0430 Subject: [PATCH] send: don't used getlogin() and simplify put_date() Now neatcc can compile mailx! --- send.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/send.c b/send.c index ac6ead4..92d4564 100644 --- a/send.c +++ b/send.c @@ -5,6 +5,7 @@ #include #include #include +#include #include "config.h" #include "mbox.h" #include "util.h" @@ -54,7 +55,7 @@ static int mail_recips(char **recips, int size, char *s) static char *put_from_(char *s) { time_t t; - char *logname = getlogin(); + char *logname = getenv("LOGNAME"); time(&t); s = put_str(s, "From "); s = put_str(s, logname ? logname : "me"); @@ -64,17 +65,10 @@ static char *put_from_(char *s) static char *put_date(char *s) { - long tz; time_t t; time(&t); - tzset(); s = put_str(s, "Date: "); - s += strftime(s, MAXLINE, "%a, %d %b %Y %H:%M:%S ", localtime(&t)); - tz = abs(timezone); - *s++ = timezone < 0 ? '-' : '+'; - s = put_intz(s, tz / 3600, 2); - s = put_intz(s, (tz % 3600) / 60, 2); - s = put_str(s, "\n"); + s += strftime(s, MAXLINE, "%a, %d %b %Y %H:%M:%S %z\n", localtime(&t)); return s; } -- 2.11.4.GIT