mblaze

Unix utilities to deal with Maildir - my mirror
git clone https://pi.duncano.de/git/mblaze.git
Log | Files | Refs | README | COPYING

commit ce625878de93a1388ae94dd21f5644f63152e299
parent 2cb93984a1a9cd50b3b27e9cfa7e4c31e8c319d7
Author: Christian Neukirchen <chneukirchen@gmail.com>
Date:   Fri, 19 Aug 2016 16:59:19 +0200

mdeliver: deliver to new/ by default, use -c for cur/ now

Diffstat:
man/mdeliver.1 | 10+++++-----
mdeliver.c | 13++++++-------
2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/man/mdeliver.1 b/man/mdeliver.1 @@ -6,7 +6,7 @@ .Nd deliver message or mailbox into Maildir .Sh SYNOPSIS .Nm -.Op Fl n +.Op Fl c .Op Fl v .Op Fl X Ar flags .Ar dir @@ -14,7 +14,7 @@ .Ar message .Nm .Fl M -.Op Fl n +.Op Fl c .Op Fl v .Op Fl X Ar flags .Ar dir @@ -54,11 +54,11 @@ The options are as follows: .Bl -tag -width Ds .It Fl M Deliver each message of an mbox. -.It Fl n +.It Fl c Deliver messages into -.Pa new/ , +.Pa cur/ , not -.Pa cur/ +.Pa new/ (the default). .It Fl v Print each message filename after delivery. diff --git a/mdeliver.c b/mdeliver.c @@ -19,12 +19,11 @@ design rationale: MBOX-O fine - date from Date: since From lines are usually crap - proper maildir delivery because it's not that hard -- messages end up in cur/ by default because you are usually importing archives - no creation of maildirs, should be a separate tool */ +static int cflag; static int Mflag; -static int nflag; static int vflag; static char *Xflag; @@ -156,7 +155,7 @@ tryagain: *f = 0; snprintf(dst, sizeof dst, "%s/%s/%s:2,%s", - targetdir, nflag ? "new" : "cur", id, + targetdir, cflag ? "cur" : "new", id, Xflag ? Xflag : statusflags); if (rename(tmp, dst) != 0) return -1; @@ -171,16 +170,16 @@ int main(int argc, char *argv[]) { int c; - while ((c = getopt(argc, argv, "MnvX:")) != -1) + while ((c = getopt(argc, argv, "cMvX:")) != -1) switch(c) { + case 'c': cflag = 1; break; case 'M': Mflag = 1; break; - case 'n': nflag = 1; break; case 'v': vflag = 1; break; case 'X': Xflag = optarg; break; default: fprintf(stderr, -"Usage: mdeliver [-n] [-v] [-X flags] dir < message\n" -" mdeliver -M [-n] [-v] [-X flags] dir < mbox\n" +"Usage: mdeliver [-c] [-v] [-X flags] dir < message\n" +" mdeliver -M [-c] [-v] [-X flags] dir < mbox\n" ); exit(1); }