Sync usage with man page.
[netbsd-mini2440.git] / external / ibm-public / postfix / dist / src / global / opened.c
blob25ef2ffc658fbdeff4f22b15219454d7c3de004c
1 /* $NetBSD$ */
3 /*++
4 /* NAME
5 /* opened 3
6 /* SUMMARY
7 /* log that a message was opened
8 /* SYNOPSIS
9 /* #include <opened.h>
11 /* void opened(queue_id, sender, size, nrcpt, format, ...)
12 /* const char *queue_id;
13 /* const char *sender;
14 /* long size;
15 /* int nrcpt;
16 /* const char *format;
17 /* DESCRIPTION
18 /* opened() logs that a message was successfully delivered.
20 /* vopened() implements an alternative interface.
22 /* Arguments:
23 /* .IP queue_id
24 /* Message queue ID.
25 /* .IP sender
26 /* Sender address.
27 /* .IP size
28 /* Message content size.
29 /* .IP nrcpt
30 /* Number of recipients.
31 /* .IP format
32 /* Format of optional text.
33 /* DIAGNOSTICS
34 /* Fatal: out of memory.
35 /* BUGS
36 /* Should be replaced by routines with an attribute-value based
37 /* interface instead of an interface that uses a rigid argument list.
38 /* LICENSE
39 /* .ad
40 /* .fi
41 /* The Secure Mailer license must be distributed with this software.
42 /* AUTHOR(S)
43 /* Wietse Venema
44 /* IBM T.J. Watson Research
45 /* P.O. Box 704
46 /* Yorktown Heights, NY 10598, USA
47 /*--*/
49 /* System library. */
51 #include <sys_defs.h>
52 #include <stdlib.h> /* 44BSD stdarg.h uses abort() */
53 #include <stdarg.h>
55 /* Utility library. */
57 #include <msg.h>
58 #include <vstring.h>
60 /* Global library. */
62 #include "opened.h"
64 /* opened - log that a message was opened */
66 void opened(const char *queue_id, const char *sender, long size, int nrcpt,
67 const char *fmt,...)
69 va_list ap;
71 va_start(ap, fmt);
72 vopened(queue_id, sender, size, nrcpt, fmt, ap);
73 va_end(ap);
76 /* vopened - log that a message was opened */
78 void vopened(const char *queue_id, const char *sender, long size, int nrcpt,
79 const char *fmt, va_list ap)
81 VSTRING *text = vstring_alloc(100);
83 #define TEXT (vstring_str(text))
85 vstring_vsprintf(text, fmt, ap);
86 msg_info("%s: from=<%s>, size=%ld, nrcpt=%d%s%s%s",
87 queue_id, sender, size, nrcpt,
88 *TEXT ? " (" : "", TEXT, *TEXT ? ")" : "");
89 vstring_free(text);