about summary refs log tree commit diff
path: root/seq.c
diff options
context:
space:
mode:
authorLeah Neukirchen <leah@vuxu.org>2020-07-03 17:26:48 +0200
committerLeah Neukirchen <leah@vuxu.org>2020-07-03 17:26:48 +0200
commite7442fcc72d0720d0b2190795958aa235b22a909 (patch)
tree5eefbbff3778e35569d07a776d98b2966aaafe55 /seq.c
parent54283ebeeedbd29c7b151be8c1ecdd054ed5595f (diff)
downloadmblaze-e7442fcc72d0720d0b2190795958aa235b22a909.tar.gz
mblaze-e7442fcc72d0720d0b2190795958aa235b22a909.tar.xz
mblaze-e7442fcc72d0720d0b2190795958aa235b22a909.zip
seq: - now refers to the message on stdin, use .- for previous message
Diffstat (limited to 'seq.c')
-rw-r--r--seq.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/seq.c b/seq.c
index 59a9470..970e30b 100644
--- a/seq.c
+++ b/seq.c
@@ -151,6 +151,9 @@ blaze822_seq_cur(void)
 int
 blaze822_seq_setcur(char *s)
 {
+	if (strcmp(s, "/dev/stdin") == 0)
+		return 0;
+
 	char *override = getenv("MAILDOT");
 	if (override)
 		return 0;
@@ -180,7 +183,7 @@ parse_relnum(char *a, long cur, long start, long last, long *out)
 
 	if (strcmp(a, "+") == 0)
 		a = ".+1";
-	else if (strcmp(a, "-") == 0)
+	else if (strcmp(a, ".-") == 0)
 		a = ".-1";
 	else if (strcmp(a, ".") == 0)
 		a = ".+0";
@@ -538,6 +541,14 @@ blaze822_loop(int argc, char *argv[], void (*cb)(char *))
 	for (i = 0; i < argc; i++) {
 		if (strchr(argv[i], '/')) {  // a file name
 			j += iterdir(argv[i], cb);
+		} else if (strcmp(argv[i], "-") == 0) {
+			if (isatty(0)) {
+				fprintf(stderr, "mblaze: warning: - now means "
+				    "read mail text from standard input, "
+				    "use .- to refer to previous mail\n");
+			}
+			cb("/dev/stdin");
+			j++;
 		} else {
 			if (!map_opened) {
 				map = blaze822_seq_open(0);