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