summaryrefslogtreecommitdiff
path: root/sys/src/cmd/upas/smtp/smtpd.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2020-09-26 11:20:42 -0700
committerOri Bernstein <ori@eigenstate.org>2020-09-26 11:20:42 -0700
commitd9f9e10e7b3ad61342ec1d9b034dd17f8452ccbc (patch)
tree3a0b155a8b2273cfe41110fe0a15ce50d6eb1e4f /sys/src/cmd/upas/smtp/smtpd.c
parent9afa5550f7497f84fb157ba07ff94301dbe06bcc (diff)
upas: convert to tmdate, change timezone format
Complete the conversion of upas to remove ctime, use the new date library, and print time zones in +hhmm format, instead of NNN format. This may affect code that expects specific names for timezones. Fix that code.
Diffstat (limited to 'sys/src/cmd/upas/smtp/smtpd.c')
-rw-r--r--sys/src/cmd/upas/smtp/smtpd.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/src/cmd/upas/smtp/smtpd.c b/sys/src/cmd/upas/smtp/smtpd.c
index aa05c6a45..0c974a835 100644
--- a/sys/src/cmd/upas/smtp/smtpd.c
+++ b/sys/src/cmd/upas/smtp/smtpd.c
@@ -92,8 +92,10 @@ main(int argc, char **argv)
{
char *netdir;
char buf[1024];
+ Tm tm;
netdir = nil;
+ tmfmtinstall();
quotefmtinstall();
fmtinstall('I', eipfmt);
fmtinstall('[', encodefmt);
@@ -163,7 +165,7 @@ main(int argc, char **argv)
snprint(buf, sizeof(buf), "%s/smtpd.db", UPASLOG);
if (open(buf, OWRITE) >= 0) {
seek(2, 0, 2);
- fprint(2, "%d smtpd %s\n", getpid(), thedate());
+ fprint(2, "%d smtpd %τ\n", getpid(), thedate(&tm));
} else
debug = 0;
}
@@ -1169,6 +1171,7 @@ pipemsg(int *byteswritten)
char *cp;
int n, nbytes, sawdot, status;
String *hdr, *line;
+ Tm tm;
pipesig(&status); /* set status to 1 on write to closed pipe */
sawdot = 0;
@@ -1180,12 +1183,12 @@ pipemsg(int *byteswritten)
* add a 'From ' line as envelope and Received: stamp
*/
nbytes = 0;
- nbytes += Bprint(pp->std[0]->fp, "From %s %s remote from \n",
- s_to_c(senders.first->p), thedate());
+ nbytes += Bprint(pp->std[0]->fp, "From %s %τ remote from \n",
+ s_to_c(senders.first->p), thedate(&tm));
nbytes += Bprint(pp->std[0]->fp, "Received: from %s ", him);
if(nci->rsys)
nbytes += Bprint(pp->std[0]->fp, "([%s]) ", nci->rsys);
- nbytes += Bprint(pp->std[0]->fp, "by %s; %s\n", me, thedate());
+ nbytes += Bprint(pp->std[0]->fp, "by %s; %τ\n", me, thedate(&tm));
/*
* read first 16k obeying '.' escape. we're assuming