e5161c5a4515a86a8b643c564c140f1a6552fb4b
[mmh] / sbr / seq_setprev.c
1
2 /*
3  * seq_setprev.c -- set the Previous-Sequence
4  *
5  * $Id$
6  */
7
8 #include <h/mh.h>
9
10 /*
11  * Add all the messages currently SELECTED to
12  * the Previous-Sequence.  This way, when the next
13  * command is given, there is a convenient way to
14  * selected all the messages used in the previous
15  * command.
16  */
17
18 void
19 seq_setprev (struct msgs *mp)
20 {
21     char **ap, *cp, *dp;
22
23     /*
24      * Get the list of sequences for Previous-Sequence
25      * and split them.
26      */
27     if ((cp = context_find (psequence))) {
28         dp = getcpy (cp);
29         if (!(ap = brkstring (dp, " ", "\n")) || !*ap) {
30             free (dp);
31             return;
32         }
33     } else {
34         return;
35     }
36
37     /* Now add all SELECTED messages to each sequence */
38     for (; *ap; ap++)
39         seq_addsel (mp, *ap, -1, 1);
40
41     free (dp);
42 }