1 /*
2 ** seq_print.c -- Routines to print sequence information.
3 **
4 ** This code is Copyright (c) 2002, by the authors of nmh. See the
5 ** COPYRIGHT file in the root directory of the nmh distribution for
6 ** complete copyright information.
7 */
8
9 #include <h/mh.h>
10
11 #define empty(s) ((s) ? (s) : "")
12
13 /*
14 ** Print all the sequences in a folder
15 */
16 void
seq_printall(struct msgs * mp)17 seq_printall(struct msgs *mp)
18 {
19 int i;
20 char *list;
21
22 for (i = 0; mp->msgattrs[i]; i++) {
23 list = seq_list(mp, mp->msgattrs[i]);
24 printf("%s%s: %s\n", mp->msgattrs[i],
25 is_seq_private(mp, i) ? " (private)" : "",
26 empty(list));
27 }
28 }
29
30
31 /*
32 ** Print a particular sequence in a folder
33 */
34 void
seq_print(struct msgs * mp,char * seqname)35 seq_print(struct msgs *mp, char *seqname)
36 {
37 int i;
38 char *list;
39
40 /* get the index of sequence */
41 i = seq_getnum(mp, seqname);
42
43 /* get sequence information */
44 list = seq_list(mp, seqname);
45
46 printf("%s%s: %s\n", seqname, (i == -1) ? "" :
47 is_seq_private(mp, i) ? " (private)" : "", empty(list));
48 }
49