summaryrefslogtreecommitdiff
path: root/lib/ZFmtSmRLst.c
diff options
context:
space:
mode:
authorGravatar John Kohl <jtkohl@mit.edu>1988-06-15 13:22:06 +0000
committerGravatar John Kohl <jtkohl@mit.edu>1988-06-15 13:22:06 +0000
commit32fd0e1605c20406fcb5dad6f9619d6b5d747c8e (patch)
treef78b07b9f9ee2cb3e0e8967fd68f6f816e800c76 /lib/ZFmtSmRLst.c
parentddd9009109578d25cced7c894590dea07e3005a0 (diff)
Initial revision
Diffstat (limited to 'lib/ZFmtSmRLst.c')
-rw-r--r--lib/ZFmtSmRLst.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/lib/ZFmtSmRLst.c b/lib/ZFmtSmRLst.c
new file mode 100644
index 0000000..cff1fd8
--- /dev/null
+++ b/lib/ZFmtSmRLst.c
@@ -0,0 +1,55 @@
+/* This file is part of the Project Athena Zephyr Notification System.
+ * It contains source for the ZFormatSmallRawNoticeList function.
+ *
+ * Created by: John Kohl
+ *
+ * $Source$
+ * $Author$
+ *
+ * Copyright (c) 1988 by the Massachusetts Institute of Technology.
+ * For copying and distribution information, see the file
+ * "mit-copyright.h".
+ */
+/* $Header$ */
+
+#ifndef lint
+static char rcsid_ZFormatRawNoticeList_c[] = "$Header$";
+#endif lint
+
+#include <zephyr/mit-copyright.h>
+
+#include <zephyr/zephyr_internal.h>
+
+Code_t ZFormatSmallRawNoticeList(notice, list, nitems, buffer, ret_len)
+ ZNotice_t *notice;
+ char *list[];
+ int nitems;
+ ZPacket_t buffer;
+ int *ret_len;
+{
+ Code_t retval;
+ int hdrlen, i, size;
+
+ if ((retval = Z_FormatRawHeader(notice, buffer, Z_MAXHEADERLEN, &hdrlen))
+ != ZERR_NONE)
+ return (retval);
+
+ size = 0;
+ for (i=0;i<nitems;i++)
+ size += strlen(list[i])+1;
+
+ *ret_len = hdrlen+size;
+
+ if (*ret_len > Z_MAXPKTLEN)
+ return (ZERR_PKTLEN);
+
+ ptr = buffer+hdrlen;
+
+ for (;nitems;nitems--, list++) {
+ i = strlen(*list)+1;
+ bcopy(*list, ptr, i);
+ ptr += i;
+ }
+
+ return (ZERR_NONE);
+}