1 /* This file is part of the Project Athena Zephyr Notification System.
2 * It contains source for the ZFormatNoticeList function.
4 * Created by: Robert French
7 * $Author: warmenhoven $
9 * Copyright (c) 1987,1991 by the Massachusetts Institute of Technology.
10 * For copying and distribution information, see the file
18 static const char rcsid_ZFormatNoticeList_c
[] =
19 "$Id: ZFmtList.c 2096 2001-07-31 01:00:39Z warmenhoven $";
22 Code_t
ZFormatNoticeList(notice
, list
, nitems
, buffer
, ret_len
,
29 Z_AuthProc cert_routine
;
31 char header
[Z_MAXHEADERLEN
];
37 if ((retval
= Z_FormatHeader(notice
, header
, sizeof(header
), &hdrlen
,
38 cert_routine
)) != ZERR_NONE
)
42 for (i
=0;i
<nitems
;i
++)
43 size
+= strlen(list
[i
])+1;
45 *ret_len
= hdrlen
+size
;
47 /* *ret_len can never be zero here, no need to worry about malloc(0). */
48 if (!(*buffer
= (char *) malloc((unsigned)*ret_len
)))
51 (void) memcpy(*buffer
, header
, hdrlen
);
55 for (;nitems
;nitems
--, list
++) {
57 (void) memcpy(ptr
, *list
, i
);