about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-07-26 17:14:28 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-07-26 17:14:28 +0200
commite25dfa5554ae2ade96bb28c45cd983a6f6438365 (patch)
tree448ccc55ed9ec598e05cb30d5d04719d0dca5869
parent93842048c69fb9bf012b35b08770587960ca9b61 (diff)
downloadmblaze-e25dfa5554ae2ade96bb28c45cd983a6f6438365.tar.gz
mblaze-e25dfa5554ae2ade96bb28c45cd983a6f6438365.tar.xz
mblaze-e25dfa5554ae2ade96bb28c45cd983a6f6438365.zip
mseq: -C to set the current message
-rw-r--r--man/mseq.123
-rw-r--r--mseq.c13
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);