]> diplodocus.org Git - nmh/blob - sbr/seq_print.c
24f669a1dbd41dc6a546624ad5f14c2486823949
[nmh] / sbr / seq_print.c
1 /* seq_print.c -- Routines to print sequence information.
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
10 #define empty(s) ((s) ? (s) : "")
11
12 /*
13 * Print all the sequences in a folder
14 */
15 void
16 seq_printall (struct msgs *mp)
17 {
18 size_t i;
19 char *list;
20
21 for (i = 0; i < svector_size (mp->msgattrs); i++) {
22 list = seq_list (mp, svector_at (mp->msgattrs, i));
23 printf ("%s%s: %s\n", svector_at (mp->msgattrs, i),
24 is_seq_private (mp, i) ? " (private)" : "", empty(list));
25 }
26 }
27
28
29 /*
30 * Print a particular sequence in a folder
31 */
32 void
33 seq_print (struct msgs *mp, char *seqname)
34 {
35 int i;
36 char *list;
37
38 /* get the index of sequence */
39 i = seq_getnum (mp, seqname);
40
41 /* get sequence information */
42 list = seq_list (mp, seqname);
43
44 printf ("%s%s: %s\n", seqname,
45 (i == -1) ? "" : is_seq_private(mp, i) ? " (private)" : "", empty(list));
46 }