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