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