4 #include "date822fmt.h"
7 /* "Date: 26 Sep 1995 04:46:53 -0000\n" */
8 stralloc newfield_date = {0};
9 /* "Message-ID: <19950926044653.12345.qmail@silverton.berkeley.edu>\n" */
10 stralloc newfield_msgid = {0};
12 static unsigned int datefmt(s,when)
19 datetime_tai(&dt,when);
21 i = fmt_str(s,"Date: "); len += i; if (s) s += i;
22 i = date822fmt(s,&dt); len += i; if (s) s += i;
26 static unsigned int msgidfmt(s,idhost,idhostlen,when)
35 datetime_tai(&dt,when);
37 i = fmt_str(s,"Message-ID: <"); len += i; if (s) s += i;
38 i = fmt_uint(s,dt.year + 1900); len += i; if (s) s += i;
39 i = fmt_uint0(s,dt.mon + 1,2); len += i; if (s) s += i;
40 i = fmt_uint0(s,dt.mday,2); len += i; if (s) s += i;
41 i = fmt_uint0(s,dt.hour,2); len += i; if (s) s += i;
42 i = fmt_uint0(s,dt.min,2); len += i; if (s) s += i;
43 i = fmt_uint0(s,dt.sec,2); len += i; if (s) s += i;
44 i = fmt_str(s,"."); len += i; if (s) s += i;
45 i = fmt_uint(s,getpid()); len += i; if (s) s += i;
46 i = fmt_str(s,".qmail@"); len += i; if (s) s += i;
47 i = fmt_strn(s,idhost,idhostlen); len += i; if (s) s += i;
48 i = fmt_str(s,">\n"); len += i; if (s) s += i;
52 int newfield_datemake(when)
55 if (!stralloc_ready(&newfield_date,datefmt(FMT_LEN,when))) return 0;
56 newfield_date.len = datefmt(newfield_date.s,when);
60 int newfield_msgidmake(idhost,idhostlen,when)
65 if (!stralloc_ready(&newfield_msgid,msgidfmt(FMT_LEN,idhost,idhostlen,when))) return 0;
66 newfield_msgid.len = msgidfmt(newfield_msgid.s,idhost,idhostlen,when);