]> diplodocus.org Git - nmh/blob - sbr/seq_setprev.c
Fixed mhshow part markers when displaying multiple messages.
[nmh] / sbr / seq_setprev.c
1 /* seq_setprev.c -- set the Previous-Sequence
2 *
3 * This code is Copyright (c) 2002, by the authors of nmh. See the
4 * COPYRIGHT file in the root directory of the nmh distribution for
5 * complete copyright information.
6 */
7
8 #include "h/mh.h"
9 #include "seq_setprev.h"
10 #include "context_find.h"
11 #include "brkstring.h"
12 #include "seq_add.h"
13 #include "h/utils.h"
14
15 /*
16 * Add all the messages currently SELECTED to
17 * the Previous-Sequence. This way, when the next
18 * command is given, there is a convenient way to
19 * selected all the messages used in the previous
20 * command.
21 */
22
23 void
24 seq_setprev (struct msgs *mp)
25 {
26 char **ap, *cp, *dp;
27
28 /*
29 * Get the list of sequences for Previous-Sequence
30 * and split them.
31 */
32 if (!(cp = context_find(psequence)))
33 return;
34 dp = mh_xstrdup(cp);
35 if (!(ap = brkstring(dp, " ", "\n")) || !*ap) {
36 free(dp);
37 return;
38 }
39
40 /* Now add all SELECTED messages to each sequence */
41 for (; *ap; ap++)
42 seq_addsel (mp, *ap, -1, 1);
43
44 free (dp);
45 }