]> diplodocus.org Git - nmh/blob - sbr/seq_setprev.c
0dab8e6c9fb8708ea8feedbd7ba49b71073d58e3
[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 "brkstring.h"
10 #include "seq_add.h"
11 #include "h/utils.h"
12
13 /*
14 * Add all the messages currently SELECTED to
15 * the Previous-Sequence. This way, when the next
16 * command is given, there is a convenient way to
17 * selected all the messages used in the previous
18 * command.
19 */
20
21 void
22 seq_setprev (struct msgs *mp)
23 {
24 char **ap, *cp, *dp;
25
26 /*
27 * Get the list of sequences for Previous-Sequence
28 * and split them.
29 */
30 if (!(cp = context_find(psequence)))
31 return;
32 dp = mh_xstrdup(cp);
33 if (!(ap = brkstring(dp, " ", "\n")) || !*ap) {
34 free(dp);
35 return;
36 }
37
38 /* Now add all SELECTED messages to each sequence */
39 for (; *ap; ap++)
40 seq_addsel (mp, *ap, -1, 1);
41
42 free (dp);
43 }