Expand PMF_FN_* macros.
[netbsd-mini2440.git] / external / ibm-public / postfix / dist / src / global / dsn_print.c
bloba1ff77f554580e227fc874676e791a057bb54127
1 /* $NetBSD$ */
3 /*++
4 /* NAME
5 /* dsn_print
6 /* SUMMARY
7 /* write DSN structure to stream
8 /* SYNOPSIS
9 /* #include <dsn_print.h>
11 /* int dsn_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 /* dsn_print() writes a DSN structure to the named stream using
18 /* the specified attribute print routine. dsn_print() is meant
19 /* to be passed as a call-back to attr_print(), thusly:
21 /* ... ATTR_TYPE_FUNC, dsn_print, (void *) dsn, ...
22 /* DIAGNOSTICS
23 /* Fatal: out of memory.
24 /* LICENSE
25 /* .ad
26 /* .fi
27 /* The Secure Mailer license must be distributed with this software.
28 /* AUTHOR(S)
29 /* Wietse Venema
30 /* IBM T.J. Watson Research
31 /* P.O. Box 704
32 /* Yorktown Heights, NY 10598, USA
33 /*--*/
35 /* System library. */
37 #include <sys_defs.h>
39 /* Utility library. */
41 #include <attr.h>
43 /* Global library. */
45 #include <mail_proto.h>
46 #include <dsn_print.h>
48 /* dsn_print - write DSN to stream */
50 int dsn_print(ATTR_PRINT_MASTER_FN print_fn, VSTREAM *fp,
51 int flags, void *ptr)
53 DSN *dsn = (DSN *) ptr;
54 int ret;
57 * The attribute order is determined by backwards compatibility. It can
58 * be sanitized after all the ad-hoc DSN read/write code is replaced.
60 ret = print_fn(fp, flags | ATTR_FLAG_MORE,
61 ATTR_TYPE_STR, MAIL_ATTR_DSN_STATUS, dsn->status,
62 ATTR_TYPE_STR, MAIL_ATTR_DSN_DTYPE, dsn->dtype,
63 ATTR_TYPE_STR, MAIL_ATTR_DSN_DTEXT, dsn->dtext,
64 ATTR_TYPE_STR, MAIL_ATTR_DSN_MTYPE, dsn->mtype,
65 ATTR_TYPE_STR, MAIL_ATTR_DSN_MNAME, dsn->mname,
66 ATTR_TYPE_STR, MAIL_ATTR_DSN_ACTION, dsn->action,
67 ATTR_TYPE_STR, MAIL_ATTR_WHY, dsn->reason,
68 ATTR_TYPE_END);
69 return (ret);