Added all of the MH sources, including RCS files, in
[mmh] / docs / historical / mh-6.8.5 / sbr / m_setseq.c
1 /* m_setseq.c - set the previous-sequence */
2
3 #include "../h/mh.h"
4 #include <stdio.h>
5
6
7 void m_setseq (mp)
8 register struct msgs *mp;
9 {
10     register int    msgnum;
11     register char  *cp,
12                    *dp,
13                   **ap;
14
15     dp = NULL;
16     if ((cp = m_find (psequence)) == NULL
17             || (ap = brkstring (dp = getcpy (cp), " ", "\n")) == NULL
18             || *ap == NULL) {
19         if (dp)
20             free (dp);
21         return;
22     }
23
24     for (; *ap; ap++)
25         if (m_seqnew (mp, *ap, -1))
26             for (msgnum = mp -> lowsel; msgnum <= mp -> hghsel; msgnum++)
27                 if (mp -> msgstats[msgnum] & SELECTED)
28                     (void) m_seqadd (mp, *ap, msgnum, -1);
29
30     if (dp)
31         free (dp);
32 }