File: seq_print.c

package info (click to toggle)
nmh 1.3-1
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 4,056 kB
  • ctags: 4,531
  • sloc: ansic: 50,788; sh: 3,141; makefile: 965; awk: 74
file content (50 lines) | stat: -rw-r--r-- 1,042 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

/*
 * seq_print.c -- Routines to print sequence information.
 *
 * $Id: seq_print.c,v 1.2 2002/07/02 22:09:14 kenh Exp $
 *
 * This code is Copyright (c) 2002, by the authors of nmh.  See the
 * COPYRIGHT file in the root directory of the nmh distribution for
 * complete copyright information.
 */

#include <h/mh.h>

#define empty(s) ((s) ? (s) : "")

/*
 * Print all the sequences in a folder
 */
void
seq_printall (struct msgs *mp)
{
    int i;
    char *list;

    for (i = 0; mp->msgattrs[i]; i++) {
	list = seq_list (mp, mp->msgattrs[i]);
	printf ("%s%s: %s\n", mp->msgattrs[i],
	    is_seq_private (mp, i) ? " (private)" : "", empty(list));
    }
}


/*
 * Print a particular sequence in a folder
 */
void
seq_print (struct msgs *mp, char *seqname)
{
    int i;
    char *list;

    /* get the index of sequence */
    i = seq_getnum (mp, seqname);

    /* get sequence information */
    list = seq_list (mp, seqname);

    printf ("%s%s: %s\n", seqname,
	(i == -1) ? "" : is_seq_private(mp, i) ? " (private)" : "", empty(list));
}