2086
|
1 /* This file is part of the Project Athena Zephyr Notification System.
|
|
2 * It contains source for the ZFormatNotice function.
|
|
3 *
|
|
4 * Created by: Robert French
|
|
5 *
|
|
6 * $Source$
|
|
7 * $Author: warmenhoven $
|
|
8 *
|
|
9 * Copyright (c) 1987,1988 by the Massachusetts Institute of Technology.
|
|
10 * For copying and distribution information, see the file
|
|
11 * "mit-copyright.h".
|
|
12 */
|
|
13 /* $Header$ */
|
|
14
|
|
15 #ifndef lint
|
|
16 static char rcsid_ZFormatNotice_c[] = "$Id: ZFmtNotice.c 2096 2001-07-31 01:00:39Z warmenhoven $";
|
|
17 #endif
|
|
18
|
|
19 #include <internal.h>
|
|
20
|
|
21 Code_t ZFormatNotice(notice, buffer, ret_len, cert_routine)
|
|
22 register ZNotice_t *notice;
|
|
23 char **buffer;
|
|
24 int *ret_len;
|
|
25 Z_AuthProc cert_routine;
|
|
26 {
|
|
27 char header[Z_MAXHEADERLEN];
|
|
28 int hdrlen;
|
|
29 Code_t retval;
|
|
30
|
|
31 if ((retval = Z_FormatHeader(notice, header, sizeof(header), &hdrlen,
|
|
32 cert_routine)) != ZERR_NONE)
|
|
33 return (retval);
|
|
34
|
|
35 *ret_len = hdrlen+notice->z_message_len;
|
|
36
|
|
37 /* Length can never be zero, don't have to worry about malloc(0). */
|
|
38 if (!(*buffer = (char *) malloc((unsigned)*ret_len)))
|
|
39 return (ENOMEM);
|
|
40
|
|
41 (void) memcpy(*buffer, header, hdrlen);
|
|
42 (void) memcpy(*buffer+hdrlen, notice->z_message, notice->z_message_len);
|
|
43
|
|
44 return (ZERR_NONE);
|
|
45 }
|