Commit 5f4c0e4e 5f4c0e4e16e97734ceddf6faad39f49c4487f7c7 by Sergey Poznyakoff

(_mh_msgset_parse): Fixed the semantics of last:N and prev:N.

1 parent ea5695a4
...@@ -318,7 +318,7 @@ _mh_msgset_parse (mailbox_t mbox, mh_msgset_t *msgset, int argc, char **argv) ...@@ -318,7 +318,7 @@ _mh_msgset_parse (mailbox_t mbox, mh_msgset_t *msgset, int argc, char **argv)
318 msglist = calloc (msgcnt, sizeof(*msglist)); 318 msglist = calloc (msgcnt, sizeof(*msglist));
319 for (i = 0, msgno = 0; i < argc; i++) 319 for (i = 0, msgno = 0; i < argc; i++)
320 { 320 {
321 char *p = NULL; 321 char *p = NULL, *q;
322 size_t start, end; 322 size_t start, end;
323 size_t msg_first, n; 323 size_t msg_first, n;
324 long num; 324 long num;
...@@ -380,9 +380,15 @@ _mh_msgset_parse (mailbox_t mbox, mh_msgset_t *msgset, int argc, char **argv) ...@@ -380,9 +380,15 @@ _mh_msgset_parse (mailbox_t mbox, mh_msgset_t *msgset, int argc, char **argv)
380 break; 380 break;
381 381
382 case ':': 382 case ':':
383 num = strtoul (p+1, &p, 0); 383 num = strtoul (p+1, &q, 0);
384 if (*p) 384 if (*q)
385 msgset_abort (argv[i]); 385 msgset_abort (argv[i]);
386 if (p[1] != '+' && p[1] != '-')
387 {
388 if (strncmp (argv[i], "last:", 5) == 0
389 || strncmp (argv[i], "prev:", 5) == 0)
390 num = -num;
391 }
386 end = start + num; 392 end = start + num;
387 if (end < start) 393 if (end < start)
388 { 394 {
......