Skip to content

Commit

Permalink
Header reorganization: common Date: Message-ID: routine.
Browse files Browse the repository at this point in the history
  • Loading branch information
bruceg committed Dec 17, 2004
1 parent 3745506 commit ea0933e
Show file tree
Hide file tree
Showing 13 changed files with 94 additions and 165 deletions.
59 changes: 32 additions & 27 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,11 @@ ezmlm-clean: \
load ezmlm-clean.o auto_qmail.o auto_version.o getconf.o copy.o mime.a \
now.o datetime.o date822fmt.o slurpclose.o slurp.o qmail.o quote.o \
getln.a env.a sig.a strerr.a substdio.a stralloc.a alloc.a surf.a hdr.a \
error.a str.a fs.a case.a open.a seek.a wait.a lock.a fd.a cookie.o getopt.a
error.a str.a fs.a case.a open.a seek.a wait.a lock.a fd.a makehash.o getopt.a
./load ezmlm-clean auto_qmail.o auto_version.o getconf.o copy.o hdr.a \
mime.a now.o datetime.o date822fmt.o slurpclose.o slurp.o qmail.o \
quote.o getln.a env.a sig.a strerr.a substdio.a stralloc.a alloc.a \
error.a str.a fs.a case.a open.a seek.a wait.a lock.a fd.a cookie.o \
error.a str.a fs.a case.a open.a seek.a wait.a lock.a fd.a makehash.o \
getopt.a surf.a

ezmlm-clean.0: \
Expand Down Expand Up @@ -362,7 +362,7 @@ ezmlm-confirm.o: \
compile ezmlm-confirm.c error.h stralloc.h gen_alloc.h str.h \
env.h sig.h slurp.h getconf.h strerr.h byte.h getln.h case.h \
qmail.h substdio.h readwrite.h seek.h quote.h datetime.h now.h \
date822fmt.h fmt.h strerr.h cookie.h errtxt.h idx.h copy.h mime.h \
fmt.h strerr.h cookie.h errtxt.h idx.h copy.h mime.h \
subgetopt.h sgetopt.h auto_bin.h fork.h wait.h
./compile ezmlm-confirm.c

Expand Down Expand Up @@ -471,7 +471,7 @@ ezmlm-gwarn.1
ezmlm-gwarn.o: \
compile ezmlm-gwarn.c direntry.h readwrite.h getln.h \
substdio.h stralloc.h gen_alloc.h slurp.h getconf.h byte.h error.h str.h \
sig.h now.h datetime.h date822fmt.h fmt.h cookie.h qmail.h substdio.h \
sig.h now.h datetime.h fmt.h cookie.h qmail.h substdio.h \
qmail.h copy.h mime.h idx.h errtxt.h sgetopt.h subgetopt.h
./compile ezmlm-gwarn.c

Expand Down Expand Up @@ -577,11 +577,11 @@ errtxt.h idx.h getln.h lock.h

ezmlm-manage: \
load ezmlm-manage.o auto_qmail.o auto_version.o getconf.o subdb.a log.o \
cookie.o now.o datetime.o date822fmt.o slurpclose.o slurp.o qmail.o \
quote.o surf.a getln.a env.a sig.a strerr.a substdio.a stralloc.a alloc.a \
error.a str.a fs.a case.a open.a seek.a wait.a lock.a fd.a getopt.a \
makehash.o cookie.o now.o datetime.o date822fmt.o slurpclose.o slurp.o \
qmail.o quote.o surf.a getln.a env.a sig.a strerr.a substdio.a stralloc.a \
alloc.a error.a str.a fs.a case.a open.a seek.a wait.a lock.a fd.a getopt.a \
mime.a copy.o auto_version.o hdr.a sql.lib
./load ezmlm-manage subdb.a auto_qmail.o getconf.o copy.o \
./load ezmlm-manage subdb.a auto_qmail.o getconf.o copy.o makehash.o \
mime.a log.o cookie.o now.o datetime.o date822fmt.o slurpclose.o \
slurp.o qmail.o quote.o surf.a getln.a env.a sig.a strerr.a \
substdio.a stralloc.a alloc.a error.a str.a fs.a case.a hdr.a \
Expand All @@ -601,7 +601,7 @@ byte.h ezmlm-manage.c getln.h ezmlm-manage.c case.h ezmlm-manage.c \
qmail.h substdio.h qmail.h ezmlm-manage.c substdio.h substdio.h \
ezmlm-manage.c readwrite.h ezmlm-manage.c seek.h ezmlm-manage.c \
quote.h ezmlm-manage.c datetime.h ezmlm-manage.c now.h datetime.h \
datetime.h now.h ezmlm-manage.c date822fmt.h ezmlm-manage.c fmt.h \
datetime.h now.h ezmlm-manage.c ezmlm-manage.c fmt.h \
ezmlm-manage.c subscribe.h strerr.h strerr.h subscribe.h \
sgetopt.h subgetopt.h cookie.h idx.h errtxt.h copy.h hdr.h
./compile ezmlm-manage.c
Expand All @@ -615,10 +615,10 @@ load ezmlm-moderate.o auto_qmail.o getconf.o auto_bin.o copy.o mime.a \
cookie.o now.o datetime.o date822fmt.o slurpclose.o slurp.o qmail.o quote.o \
surf.a getln.a env.a sig.a strerr.a substdio.a stralloc.a alloc.a wrap.a \
error.a str.a fs.a case.a open.a seek.a wait.a lock.a fd.a getopt.a hdr.a \
auto_version.o
makehash.o auto_version.o
./load ezmlm-moderate auto_qmail.o getconf.o copy.o mime.a hdr.a \
cookie.o now.o datetime.o date822fmt.o slurpclose.o slurp.o \
qmail.o quote.o surf.a getln.a env.a sig.a wrap.a strerr.a \
makehash.o cookie.o now.o datetime.o date822fmt.o slurpclose.o \
slurp.o qmail.o quote.o surf.a getln.a env.a sig.a wrap.a strerr.a \
substdio.a stralloc.a alloc.a error.a str.a fs.a case.a \
auto_bin.o open.a seek.a wait.a lock.a fd.a getopt.a \
auto_version.o
Expand All @@ -631,28 +631,28 @@ ezmlm-moderate.o: \
compile ezmlm-moderate.c error.h stralloc.h gen_alloc.h str.h \
env.h sig.h slurp.h getconf.h strerr.h byte.h getln.h case.h hdr.h \
qmail.h substdio.h readwrite.h seek.h quote.h datetime.h now.h \
date822fmt.h fmt.h strerr.h cookie.h errtxt.h idx.h copy.h mime.h \
fmt.h strerr.h cookie.h errtxt.h idx.h copy.h mime.h \
subgetopt.h sgetopt.h auto_bin.h fork.h wait.h
./compile ezmlm-moderate.c

ezmlm-request: \
load ezmlm-request.o subdb.a getconf.o constmap.o getln.a auto_qmail.o qmail.o \
strerr.a slurpclose.o slurp.o getopt.a env.a open.a fd.a sig.a case.a hdr.a \
substdio.a error.a stralloc.a alloc.a str.a case.a fs.a wait.a seek.a \
date822fmt.o now.o datetime.o quote.o copy.o mime.a sql.lib
substdio.a error.a stralloc.a alloc.a str.a case.a fs.a wait.a seek.a surf.a \
makehash.o date822fmt.o now.o datetime.o quote.o copy.o mime.a sql.lib
./load ezmlm-request subdb.a getconf.o constmap.o getln.a auto_qmail.o \
qmail.o date822fmt.o datetime.o now.o quote.o auto_version.o hdr.a \
slurpclose.o slurp.o env.a open.a sig.a wait.a getopt.a \
slurpclose.o slurp.o env.a open.a sig.a wait.a getopt.a makehash.o \
strerr.a substdio.a error.a copy.o stralloc.a alloc.a substdio.a \
str.a case.a fs.a fd.a sig.a wait.a seek.a mime.a `cat sql.lib`
surf.a str.a case.a fs.a fd.a sig.a wait.a seek.a mime.a `cat sql.lib`

ezmlm-request.0:
nroff -man ezmlm-request.1 > ezmlm-request.0

ezmlm-request.o: \
compile ezmlm-request.c stralloc.h subfd.h strerr.h error.h qmail.h env.h \
sig.h open.h getln.h case.h str.h readwrite.h exit.h substdio.h quote.h \
getconf.h constmap.h fmt.h byte.h errtxt.h idx.h datetime.h date822fmt.h \
getconf.h constmap.h fmt.h byte.h errtxt.h idx.h datetime.h \
subscribe.h now.h copy.h cookie.h
./compile ezmlm-request.c

Expand Down Expand Up @@ -814,7 +814,7 @@ compile ezmlm-store.c error.h stralloc.h gen_alloc.h str.h \
sgetopt.h subgetopt.h fork.h wait.h auto_bin.h lock.h mime.h \
env.h sig.h slurp.h getconf.h strerr.h byte.h getln.h case.h \
qmail.h substdio.h readwrite.h seek.h quote.h datetime.h now.h \
date822fmt.h fmt.h subscribe.h strerr.h cookie.h errtxt.h idx.h copy.h
fmt.h subscribe.h strerr.h cookie.h errtxt.h idx.h copy.h
./compile ezmlm-store.c

ezmlm-sub: \
Expand Down Expand Up @@ -886,11 +886,11 @@ log.h errtxt.h sgetopt.h scan.h idx.h readwrite.h stralloc.h substdio.h
./compile ezmlm-unsub.c

ezmlm-warn: \
load ezmlm-warn.o auto_qmail.o getconf.o mime.a cookie.o subdb.a now.o \
slurpclose.o slurp.o quote.o datetime.o date822fmt.o qmail.o surf.a \
case.a strerr.a sig.a getln.a substdio.a stralloc.a alloc.a error.a \
load ezmlm-warn.o auto_qmail.o getconf.o mime.a cookie.o makehash.o subdb.a \
now.o slurpclose.o slurp.o quote.o datetime.o date822fmt.o qmail.o surf.a \
case.a strerr.a sig.a getln.a substdio.a stralloc.a alloc.a error.a hdr.a \
open.a lock.a str.a fs.a fd.a wait.a copy.o getopt.a auto_version.o sql.lib
./load ezmlm-warn auto_qmail.o getconf.o mime.a \
./load ezmlm-warn auto_qmail.o getconf.o mime.a hdr.a makehash.o \
cookie.o subdb.a getopt.a now.o slurpclose.o slurp.o quote.o \
datetime.o date822fmt.o qmail.o surf.a case.a strerr.a sig.a \
getln.a substdio.a stralloc.a alloc.a error.a open.a lock.a \
Expand All @@ -903,7 +903,7 @@ ezmlm-warn.1
ezmlm-warn.o: \
compile ezmlm-warn.c direntry.h readwrite.h getln.h \
substdio.h stralloc.h gen_alloc.h slurp.h getconf.h byte.h error.h str.h \
sig.h now.h datetime.h date822fmt.h fmt.h cookie.h qmail.h substdio.h \
sig.h now.h datetime.h fmt.h cookie.h qmail.h substdio.h \
qmail.h copy.h mime.h idx.h errtxt.h sgetopt.h subgetopt.h
./compile ezmlm-warn.c

Expand Down Expand Up @@ -1119,13 +1119,18 @@ haswaitp.h: choose compile haswaitp.h1 haswaitp.h2 load trywaitp.c
./choose cl trywaitp haswaitp.h1 haswaitp.h2 > haswaitp.h

hdr.a: \
makelib hdr_ctboundary.o hdr_transferenc.o
./makelib hdr.a hdr_ctboundary.o hdr_transferenc.o
makelib hdr_ctboundary.o hdr_datemsgid.o hdr_transferenc.o
./makelib hdr.a hdr_ctboundary.o hdr_datemsgid.o hdr_transferenc.o

hdr_ctboundary.o: \
compile hdr_ctboundary.c hdr.h qmail.h cookie.h stralloc.h
compile hdr_ctboundary.c hdr.h qmail.h makehash.h stralloc.h
./compile hdr_ctboundary.c

hdr_datemsgid.o: \
compile hdr_datemsgid.c hdr.h qmail.h makehash.h stralloc.h datetime.h \
fmt.h date822fmt.h
./compile hdr_datemsgid.c

hdr_transferenc.o: \
compile hdr_transferenc.c hdr.h qmail.h
./compile hdr_transferenc.c
Expand Down
21 changes: 2 additions & 19 deletions ezmlm-clean.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "quote.h"
#include "datetime.h"
#include "now.h"
#include "date822fmt.h"
#include "direntry.h"
#include "cookie.h"
#include "sgetopt.h"
Expand Down Expand Up @@ -65,7 +64,6 @@ void die_nomem() { strerr_die2x(111,FATAL,ERR_NOMEM); }

datetime_sec when;
unsigned int older;
struct datetime dt;

char textbuf[1024];
substdio sstext;
Expand All @@ -81,7 +79,6 @@ substdio ssqq = SUBSTDIO_FDBUF(qqwrite,-1,qqbuf,sizeof(qqbuf));

char *dir;
char strnum[FMT_ULONG];
char date[DATE822FMT];
char boundary[COOKIE];
datetime_sec hashdate;

Expand Down Expand Up @@ -150,22 +147,8 @@ char *d;
qmail_put(&qq,mailinglist.s,mailinglist.len);
qmail_puts(&qq,"\nList-ID: ");
qmail_put(&qq,listid.s,listid.len);
qmail_puts(&qq,"\nDate: ");
datetime_tai(&dt,when);
qmail_put(&qq,date,date822fmt(date,&dt));
qmail_puts(&qq,"Message-ID: <");
if (!stralloc_copyb(&line,strnum,fmt_ulong(strnum,
(unsigned long) when + msgnum++))) die_nomem();
if (!stralloc_append(&line,".")) die_nomem();
if (!stralloc_catb(&line,strnum,
fmt_ulong(strnum,(unsigned long) getpid()))) die_nomem();
if (!stralloc_cats(&line,".ezmlm@")) die_nomem();
if (!stralloc_cat(&line,&outhost)) die_nomem();
if (!stralloc_0(&line)) die_nomem();
qmail_puts(&qq,line.s);
/* "unique" MIME boundary as hash of messageid */
cookie(boundary,"",0,"",line.s,"");
qmail_puts(&qq,">\nFrom: ");
hdr_datemsgid(when+msgnum++);
qmail_puts(&qq,"\nFrom: ");
if (!quote(&quoted,&outlocal)) die_nomem();
qmail_put(&qq,quoted.s,quoted.len);
qmail_puts(&qq,"-help@");
Expand Down
1 change: 0 additions & 1 deletion ezmlm-confirm.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include "quote.h"
#include "datetime.h"
#include "now.h"
#include "date822fmt.h"
#include "fmt.h"
#include "sgetopt.h"
#include "auto_bin.h"
Expand Down
21 changes: 4 additions & 17 deletions ezmlm-get.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ stralloc listno = {0};
void *psql = (void *) 0;

datetime_sec when;
struct datetime dt;
unsigned long cumsize = 0L; /* cumulative msgs / 256 */
unsigned long cumsizen = 0L; /* new cumulative msgs / 256 */
unsigned long max = 0L; /* Last message in archive */
Expand All @@ -90,7 +89,6 @@ datetime_sec digwhen; /* last digest */

char strnum[FMT_ULONG];
char szmsgnum[FMT_ULONG];
char date[DATE822FMT];
char boundary[COOKIE];
char hashout[COOKIE];
stralloc line = {0};
Expand Down Expand Up @@ -775,21 +773,8 @@ void doheaders()
qmail_puts(&qq,"\nList-ID: ");
qmail_put(&qq,line.s,line.len);
}
qmail_puts(&qq,"\nDate: ");
qmail_put(&qq,date,date822fmt(date,&dt));
qmail_puts(&qq,"Message-ID: <");
if (!stralloc_copyb(&line,strnum,fmt_ulong(strnum,(unsigned long) when)))
die_nomem();
if (!stralloc_append(&line,".")) die_nomem();
if (!stralloc_catb(&line,strnum,
fmt_ulong(strnum,(unsigned long) getpid()))) die_nomem();
if (!stralloc_cats(&line,".ezmlm@")) die_nomem();
if (!stralloc_cat(&line,&outhost)) die_nomem();
if (!stralloc_0(&line)) die_nomem();
qmail_puts(&qq,line.s);
/* "unique" MIME boundary as hash of messageid */
makehash(line.s,line.len,boundary);
qmail_puts(&qq,">\nFrom: ");
hdr_datemsgid(when);
qmail_puts(&qq,"\nFrom: ");
if (!quote(&quoted,&outlocal)) die_nomem();
qmail_put(&qq,quoted.s,quoted.len);
qmail_puts(&qq,"-help@");
Expand Down Expand Up @@ -858,6 +843,8 @@ char **argv;
subentry *subtable;
authentry *authtable;
dateentry *datetable;
struct datetime dt;
char date[DATE822FMT];

(void) umask(022);
sig_pipeignore();
Expand Down
22 changes: 3 additions & 19 deletions ezmlm-manage.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "quote.h"
#include "datetime.h"
#include "now.h"
#include "date822fmt.h"
#include "fmt.h"
#include "subscribe.h"
#include "cookie.h"
Expand Down Expand Up @@ -105,12 +104,10 @@ stralloc fneditn = {0};
stralloc charset = {0};

datetime_sec when;
struct datetime dt;
int match;
unsigned int max;

char strnum[FMT_ULONG];
char date[DATE822FMT];
char hash[COOKIE];
char boundary[COOKIE];
datetime_sec hashdate;
Expand Down Expand Up @@ -388,22 +385,9 @@ void msg_headers()
qmail_put(&qq,quoted.s,quoted.len);
qmail_puts(&qq,"-subscribe@");
qmail_put(&qq,outhost.s,outhost.len);
qmail_puts(&qq,">\nDate: ");
datetime_tai(&dt,when);
qmail_put(&qq,date,date822fmt(date,&dt));
qmail_puts(&qq,"Message-ID: <");
if (!stralloc_copyb(&line,strnum,fmt_ulong(strnum,(unsigned long) when)))
die_nomem();
if (!stralloc_append(&line,".")) die_nomem();
if (!stralloc_catb(&line,strnum,
fmt_ulong(strnum,(unsigned long) getpid()))) die_nomem();
if (!stralloc_cats(&line,".ezmlm@")) die_nomem();
if (!stralloc_cat(&line,&outhost)) die_nomem();
if (!stralloc_0(&line)) die_nomem();
qmail_puts(&qq,line.s);
/* "unique" MIME boundary as hash of messageid */
cookie(boundary,"",0,"",line.s,"");
qmail_puts(&qq,">\nFrom: ");
qmail_puts(&qq,">");
hdr_datemsgid(when);
qmail_puts(&qq,"\nFrom: ");
qmail_put(&qq,quoted.s,quoted.len);
if (act == AC_HELP) /* differnt "From:" for help to break auto- */
qmail_puts(&qq,"-return-@"); /* responder loops */
Expand Down
21 changes: 2 additions & 19 deletions ezmlm-moderate.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include "quote.h"
#include "datetime.h"
#include "now.h"
#include "date822fmt.h"
#include "fmt.h"
#include "sgetopt.h"
#include "cookie.h"
Expand Down Expand Up @@ -65,10 +64,8 @@ stralloc sendopt = {0};
stralloc comment = {0};
stralloc charset = {0};
datetime_sec when;
struct datetime dt;

char strnum[FMT_ULONG];
char date[DATE822FMT];
char hash[COOKIE];
char boundary[COOKIE];
stralloc line = {0};
Expand Down Expand Up @@ -339,22 +336,8 @@ char **argv;
qmail_puts(&qq,"\nList-ID: ");
qmail_put(&qq,line.s,line.len);
}
qmail_puts(&qq,"\nDate: ");
datetime_tai(&dt,when);
qmail_put(&qq,date,date822fmt(date,&dt));
qmail_puts(&qq,"Message-ID: <");
if (!stralloc_copyb(&line,strnum,fmt_ulong(strnum,(unsigned long) when)))
die_nomem();
if (!stralloc_append(&line,".")) die_nomem();
if (!stralloc_catb(&line,strnum,
fmt_ulong(strnum,(unsigned long) getpid()))) die_nomem();
if (!stralloc_cats(&line,".ezmlm@")) die_nomem();
if (!stralloc_cat(&line,&outhost)) die_nomem();
if (!stralloc_0(&line)) die_nomem();
qmail_puts(&qq,line.s);
/* "unique" MIME boundary as hash of messageid */
cookie(boundary,"",0,"",line.s,"");
qmail_puts(&qq,">\nFrom: ");
hdr_datemsgid(when);
qmail_puts(&qq,"\nFrom: ");
if (!quote(&quoted,&outlocal)) die_nomem();
qmail_put(&qq,quoted.s,quoted.len);
qmail_puts(&qq,"-owner@");
Expand Down
Loading

0 comments on commit ea0933e

Please sign in to comment.