diff options
author | Robert S. French <rfrench@mit.edu> | 1987-06-12 13:01:26 +0000 |
---|---|---|
committer | Robert S. French <rfrench@mit.edu> | 1987-06-12 13:01:26 +0000 |
commit | 140725197bc779a27b98fae5d992a3512097adf0 (patch) | |
tree | cbbbd9e2ba4469173257c3dee49cd56eadc361c2 /lib/ZFmtList.c | |
parent | 2a79930d731c6d85df0fc46e869a4466dbf1d1fd (diff) |
Initial revision
Diffstat (limited to 'lib/ZFmtList.c')
-rw-r--r-- | lib/ZFmtList.c | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/lib/ZFmtList.c b/lib/ZFmtList.c new file mode 100644 index 0000000..9a0aaa8 --- /dev/null +++ b/lib/ZFmtList.c @@ -0,0 +1,49 @@ +/* This file is part of the Project Athena Zephyr Notification System. + * It contains source for the ZFormatNoticeList function. + * + * Created by: Robert French + * + * $Source$ + * $Author$ + * + * Copyright (c) 1987 by the Massachusetts Institute of Technology. + * For copying and distribution information, see the file + * "mit-copyright.h". + */ +/* $Header$ */ + +#include <zephyr/mit-copyright.h> + +#include <zephyr/zephyr_internal.h> + +Code_t ZFormatNoticeList(notice,list,nitems,buffer,buffer_len,ret_len) + ZNotice_t *notice; + char *list[]; + int nitems; + ZPacket_t buffer; + int buffer_len; + int *ret_len; +{ + char *ptr,*end; + Code_t retval; + + end = buffer+buffer_len; + + if ((retval = Z_FormatHeader(notice,buffer,buffer_len,ret_len)) > 0) + return (retval); + + ptr = buffer+*ret_len; + + for (;nitems;nitems--,list++) { + if (ptr+strlen(*list)+1 > end) + return (ZERR_PKTLEN); + bcopy(*list,ptr,strlen(*list)+1); + *ret_len += strlen(*list)+1; + ptr += strlen(*list)+1; + } + + if (*ret_len > Z_MAXPKTLEN) + return (ZERR_PKTLEN); + + return (ZERR_NONE); +} |