Sync usage with man page.
[netbsd-mini2440.git] / external / ibm-public / postfix / dist / src / virtual / recipient.c
blobf2e4bc4473976fe1d262ec28a2fc86c848a9eefd
1 /* $NetBSD$ */
3 /*++
4 /* NAME
5 /* recipient 3
6 /* SUMMARY
7 /* deliver to one local recipient
8 /* SYNOPSIS
9 /* #include "virtual.h"
11 /* int deliver_recipient(state, usr_attr)
12 /* LOCAL_STATE state;
13 /* USER_ATTR *usr_attr;
14 /* DESCRIPTION
15 /* deliver_recipient() delivers a message to a local recipient.
17 /* Arguments:
18 /* .IP state
19 /* The attributes that specify the message, sender, and more.
20 /* .IP usr_attr
21 /* Attributes describing user rights and mailbox location.
22 /* DIAGNOSTICS
23 /* deliver_recipient() returns non-zero when delivery should be
24 /* tried again.
25 /* SEE ALSO
26 /* mailbox(3) delivery to UNIX-style mailbox
27 /* maildir(3) delivery to qmail-style maildir
28 /* LICENSE
29 /* .ad
30 /* .fi
31 /* The Secure Mailer license must be distributed with this software.
32 /* AUTHOR(S)
33 /* Wietse Venema
34 /* IBM T.J. Watson Research
35 /* P.O. Box 704
36 /* Yorktown Heights, NY 10598, USA
37 /*--*/
39 /* System library. */
41 #include <sys_defs.h>
43 /* Utility library. */
45 #include <msg.h>
46 #include <mymalloc.h>
47 #include <stringops.h>
49 /* Global library. */
51 #include <bounce.h>
53 /* Application-specific. */
55 #include "virtual.h"
57 /* deliver_recipient - deliver one local recipient */
59 int deliver_recipient(LOCAL_STATE state, USER_ATTR usr_attr)
61 const char *myname = "deliver_recipient";
62 int rcpt_stat;
65 * Make verbose logging easier to understand.
67 state.level++;
68 if (msg_verbose)
69 MSG_LOG_STATE(myname, state);
72 * Set up the recipient-specific attributes. The recipient's lookup
73 * handle is the full address.
75 if (state.msg_attr.delivered == 0)
76 state.msg_attr.delivered = state.msg_attr.rcpt.address;
77 state.msg_attr.user = mystrdup(state.msg_attr.rcpt.address);
78 lowercase(state.msg_attr.user);
81 * Deliver
83 if (msg_verbose)
84 deliver_attr_dump(&state.msg_attr);
86 if (deliver_mailbox(state, usr_attr, &rcpt_stat) == 0)
87 rcpt_stat = deliver_unknown(state);
90 * Cleanup.
92 myfree(state.msg_attr.user);
94 return (rcpt_stat);