2 * Copyright (c) 1989 Regents of the University of California.
3 * All rights reserved. The Berkeley software License Agreement
4 * specifies the terms and conditions for redistribution.
11 * msg: Send a formatted line to the POP client
15 pop_msg(POP
*p
, int stat
, char *format
, ...)
18 char message
[MAXLINELEN
];
23 /* Point to the message buffer */
26 /* Format the POP status code at the beginning of the message */
27 snprintf (mp
, sizeof(message
), "%s ",
28 (stat
== POP_SUCCESS
) ? POP_OK
: POP_ERR
);
30 /* Point past the POP status indicator in the message message */
33 /* Append the message (formatted, if necessary) */
35 vsnprintf (mp
, sizeof(message
) - strlen(message
),
38 /* Log the message if debugging is turned on */
40 if (p
->debug
&& stat
== POP_SUCCESS
)
41 pop_log(p
,POP_DEBUG
,"%s",message
);
44 /* Log the message if a failure occurred */
45 if (stat
!= POP_SUCCESS
)
46 pop_log(p
,POP_PRIORITY
,"%s",message
);
48 /* Append the <CR><LF> */
49 strlcat(message
, "\r\n", sizeof(message
));
51 /* Send the message to the client */
52 fputs(message
, p
->output
);