Expand PMF_FN_* macros.
[netbsd-mini2440.git] / external / ibm-public / postfix / dist / src / global / msg_stats_print.c
blob166da2f9a834422eb5a49f8a909ce4df76cf8657
1 /* $NetBSD$ */
3 /*++
4 /* NAME
5 /* msg_stats_print
6 /* SUMMARY
7 /* write MSG_STATS structure to stream
8 /* SYNOPSIS
9 /* #include <msg_stats.h>
11 /* int msg_stats_print(print_fn, stream, flags, ptr)
12 /* ATTR_PRINT_MASTER_FN print_fn;
13 /* VSTREAM *stream;
14 /* int flags;
15 /* void *ptr;
16 /* DESCRIPTION
17 /* msg_stats_print() writes an MSG_STATS structure to the named
18 /* stream using the specified attribute print routine.
19 /* msg_stats_print() is meant to be passed as a call-back to
20 /* attr_print(), thusly:
22 /* ... ATTR_TYPE_FUNC, msg_stats_print, (void *) stats, ...
23 /* DIAGNOSTICS
24 /* Fatal: out of memory.
25 /* LICENSE
26 /* .ad
27 /* .fi
28 /* The Secure Mailer license must be distributed with this software.
29 /* AUTHOR(S)
30 /* Wietse Venema
31 /* IBM T.J. Watson Research
32 /* P.O. Box 704
33 /* Yorktown Heights, NY 10598, USA
34 /*--*/
36 /* System library. */
38 #include <sys_defs.h>
40 /* Utility library. */
42 #include <attr.h>
44 /* Global library. */
46 #include <mail_proto.h>
47 #include <msg_stats.h>
49 /* msg_stats_print - write MSG_STATS to stream */
51 int msg_stats_print(ATTR_PRINT_MASTER_FN print_fn, VSTREAM *fp,
52 int flags, void *ptr)
54 int ret;
57 * Send the entire structure. This is not only simpler but also likely to
58 * be quicker than having the sender figure out what fields need to be
59 * sent, converting numbers to string and back, and having the receiver
60 * initialize the unused fields by hand.
62 ret = print_fn(fp, flags | ATTR_FLAG_MORE,
63 ATTR_TYPE_DATA, MAIL_ATTR_TIME, sizeof(MSG_STATS), ptr,
64 ATTR_TYPE_END);
65 return (ret);