1: /*
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.
5: */
6:
7: #ifndef lint
8: static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n";
9: static char SccsId[] = "@(#)@(#)pop_msg.c 2.1 2.1 3/18/91";
10: #endif not lint
11:
12: #include <stdio.h>
13: #include <sys/types.h>
14: #include <strings.h>
15: #include <varargs.h>
16: #include "popper.h"
17:
18: /*
19: * msg: Send a formatted line to the POP client
20: */
21:
22: pop_msg(va_alist)
23: va_dcl
24: {
25: POP * p;
26: int stat; /* POP status indicator */
27: char * format; /* Format string for the message */
28: va_list ap;
29: register char * mp;
30: char message[MAXLINELEN];
31:
32: va_start(ap);
33: p = va_arg(ap, POP *);
34: stat = va_arg(ap, int);
35: format = va_arg(ap, char *);
36: va_end(ap);
37:
38: /* Point to the message buffer */
39: mp = message;
40:
41: /* Format the POP status code at the beginning of the message */
42: if (stat == POP_SUCCESS)
43: (void)sprintf (mp,"%s ",POP_OK);
44: else
45: (void)sprintf (mp,"%s ",POP_ERR);
46:
47: /* Point past the POP status indicator in the message message */
48: mp += strlen(mp);
49:
50: /* Append the message (formatted, if necessary) */
51: if (format)
52: #ifdef HAVE_VSPRINTF
53: vsprintf(mp,format,ap);
54: #else
55: (void)sprintf(mp,format,((int *)ap)[0],((int *)ap)[1],((int *)ap)[2],
56: ((int *)ap)[3],((int *)ap)[4]);
57: #endif HAVE_VSPRINTF
58:
59: /* Log the message if debugging is turned on */
60: #ifdef DEBUG
61: if (p->debug && stat == POP_SUCCESS)
62: pop_log(p,POP_DEBUG,"%s",message);
63: #endif DEBUG
64:
65: /* Log the message if a failure occurred */
66: if (stat != POP_SUCCESS)
67: pop_log(p,POP_PRIORITY,"%s",message);
68:
69: /* Append the <CR><LF> */
70: (void)strcat(message, "\r\n");
71:
72: /* Send the message to the client */
73: (void)fputs(message,p->output);
74: (void)fflush(p->output);
75:
76: return(stat);
77: }
Defined functions
pop_msg
defined in line
22; used 48 times
- in /usr/src/libexec/popper/pop_dele.c line
31,
38,
58
- in /usr/src/libexec/popper/pop_dropcopy.c line
62,
92,
100-104(2),
118,
150
- in /usr/src/libexec/popper/pop_dropinfo.c line
48,
70
- in /usr/src/libexec/popper/pop_get_command.c line
80-85(2),
94
- in /usr/src/libexec/popper/pop_get_subcommand.c line
38,
44,
54
- in /usr/src/libexec/popper/pop_last.c line
23
- in /usr/src/libexec/popper/pop_list.c line
33,
41-49(3)
- in /usr/src/libexec/popper/pop_parse.c line
41
- in /usr/src/libexec/popper/pop_pass.c line
30-40(3),
57
- in /usr/src/libexec/popper/pop_rset.c line
37
- in /usr/src/libexec/popper/pop_send.c line
35,
42,
58
- in /usr/src/libexec/popper/pop_stat.c line
26
- in /usr/src/libexec/popper/pop_updt.c line
69,
75,
93,
177,
192
- in /usr/src/libexec/popper/pop_user.c line
28
- in /usr/src/libexec/popper/pop_xmit.c line
43-48(2),
83,
89-90(2)
- in /usr/src/libexec/popper/pop_xtnd.c line
37
- in /usr/src/libexec/popper/popper.c line
33,
47,
60,
66
Defined variables
SccsId
defined in line
9;
never used