1 /* This file is part of the Project Athena Zephyr Notification System.
2 * It contains source for the ZFormatNotice function.
4 * Created by: Robert French
7 * $Author: warmenhoven $
9 * Copyright (c) 1987,1988 by the Massachusetts Institute of Technology.
10 * For copying and distribution information, see the file
16 static char rcsid_ZFormatNotice_c
[] = "$Id: ZFmtNotice.c 2096 2001-07-31 01:00:39Z warmenhoven $";
21 Code_t
ZFormatNotice(notice
, buffer
, ret_len
, cert_routine
)
22 register ZNotice_t
*notice
;
25 Z_AuthProc cert_routine
;
27 char header
[Z_MAXHEADERLEN
];
31 if ((retval
= Z_FormatHeader(notice
, header
, sizeof(header
), &hdrlen
,
32 cert_routine
)) != ZERR_NONE
)
35 *ret_len
= hdrlen
+notice
->z_message_len
;
37 /* Length can never be zero, don't have to worry about malloc(0). */
38 if (!(*buffer
= (char *) malloc((unsigned)*ret_len
)))
41 (void) memcpy(*buffer
, header
, hdrlen
);
42 (void) memcpy(*buffer
+hdrlen
, notice
->z_message
, notice
->z_message_len
);