From e25dfa5554ae2ade96bb28c45cd983a6f6438365 Mon Sep 17 00:00:00 2001 From: Christian Neukirchen Date: Tue, 26 Jul 2016 17:14:28 +0200 Subject: mseq: -C to set the current message --- man/mseq.1 | 23 ++++++++++++++++++----- mseq.c | 13 ++++++++++--- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/man/mseq.1 b/man/mseq.1 index 232ceee..2b00930 100644 --- a/man/mseq.1 +++ b/man/mseq.1 @@ -6,15 +6,20 @@ .Nd manipulate mail sequence .Sh SYNOPSIS .Nm -.Op Fl f -.Op Fl n -.Op Fl r +.Op Fl fnr .Ar msgs\ ... .Nm -.Op Fl f -.Op Fl S | Fl A +.Fl S +.Op Fl fr +< +.Ar sequence +.Nm +.Fl A +.Op Fl fr < .Ar sequence +.Nm +.Fl C Ar msg .Sh DESCRIPTION .Nm prints, fixes and sets messages in the mail sequence. @@ -55,6 +60,10 @@ Set the mail sequence to the file names passed on standard input. Like .Fl S , but append to the mail sequence instead of replacing it. +.It Fl C Ar msg +Set the current message to +.Ar msg +and exit. .El .Sh ENVIRONMENT .Bl -tag -width Ds @@ -62,6 +71,10 @@ but append to the mail sequence instead of replacing it. File were the sequence is stored. (Default: .Pa ~/.santoku/seq ) +.It Ev MAILCUR +Symbolic link referring to the current message. +(Default: +.Pa ~/.santoku/cur ) .El .Sh EXIT STATUS .Ex -std diff --git a/mseq.c b/mseq.c index f20ec5a..7791d68 100644 --- a/mseq.c +++ b/mseq.c @@ -12,8 +12,9 @@ static int fflag; static int nflag; static int rflag; -static int Sflag; static int Aflag; +static char *Cflag; +static int Sflag; struct name { char *id; @@ -247,18 +248,24 @@ int main(int argc, char *argv[]) { int c; - while ((c = getopt(argc, argv, "fnrSA")) != -1) + while ((c = getopt(argc, argv, "fnrAC:S")) != -1) switch(c) { case 'f': fflag = 1; break; case 'n': nflag = 1; break; case 'r': rflag = 1; break; - case 'S': Sflag = 1; break; case 'A': Sflag = Aflag = 1; break; + case 'C': Cflag = optarg; break; + case 'S': Sflag = 1; break; default: // XXX usage exit(1); } + if (Cflag) { + blaze822_seq_setcur(Cflag); + return 0; + } + if (nflag && Sflag) { fprintf(stderr, "-n and -S/-A doesn't make sense.\n"); exit(1); -- cgit 1.4.1