mblaze

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

commit 8e833606c1b9ec9395caaec8678f59d62f1a3119
parent 7d66bb8db70d6e3f5009bde30795477bd5d46372
Author: Oliver Kiddle <okiddle@yahoo.co.uk>
Date:   Sat,  1 Jul 2017 13:09:31 +0200

seq: parse_relnum: initial + in stop part of a message range selects relative to the start

So, e.g 4:+5 is the same as 4:9

Closes: #44 [via git-merge-pr]

Diffstat:
seq.c | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/seq.c b/seq.c @@ -174,7 +174,7 @@ blaze822_seq_setcur(char *s) } static char * -parse_relnum(char *a, long cur, long last, long *out) +parse_relnum(char *a, long cur, long start, long last, long *out) { long base; char *b; @@ -194,6 +194,8 @@ parse_relnum(char *a, long cur, long last, long *out) base = cur; } else if (*a == '-') { base = last + 1; + } else if (*a == '+') { + base = start; } else { base = 0; } @@ -341,7 +343,7 @@ parse_range(char *map, char *a, long *start, long *stop, long cur, long lines) *stop = 1; while (*a && *a != ':' && *a != '=' && *a != '_' && *a != '^') { - char *b = parse_relnum(a, cur, lines, start); + char *b = parse_relnum(a, cur, 0, lines, start); if (a == b) return 0; a = b; @@ -360,7 +362,7 @@ parse_range(char *map, char *a, long *start, long *stop, long cur, long lines) if (!*a) { *stop = lines; } else { - char *b = parse_relnum(a, cur, lines, stop); + char *b = parse_relnum(a, cur, *start, lines, stop); if (a == b) return 0; }