summaryrefslogtreecommitdiff
path: root/lib/ZFmtRaw.c
diff options
context:
space:
mode:
authorGravatar Robert S. French <rfrench@mit.edu>1987-06-20 15:21:00 +0000
committerGravatar Robert S. French <rfrench@mit.edu>1987-06-20 15:21:00 +0000
commitcd73b10db92fd36835800ed839d010f5b69bdca6 (patch)
tree4e12d952a4ab1a087845c6f0bbbcb35747e7820f /lib/ZFmtRaw.c
parent569d2fcd720d80cf47db8ea70ec17c02008dec79 (diff)
Safety checkin
Diffstat (limited to 'lib/ZFmtRaw.c')
-rw-r--r--lib/ZFmtRaw.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/lib/ZFmtRaw.c b/lib/ZFmtRaw.c
new file mode 100644
index 0000000..14b637b
--- /dev/null
+++ b/lib/ZFmtRaw.c
@@ -0,0 +1,46 @@
+/* This file is part of the Project Athena Zephyr Notification System.
+ * It contains source for the ZFormatRawNotice 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.h>
+
+Code_t ZFormatRawNotice(notice,buffer,buffer_len,len)
+ ZNotice_t *notice;
+ ZPacket_t buffer;
+ int buffer_len;
+ int *len;
+{
+ char *ptr;
+ int hdrlen;
+ Code_t retval;
+
+ if ((retval = Z_FormatRawHeader(notice,buffer,buffer_len,&hdrlen)) !=
+ ZERR_NONE)
+ return (retval);
+
+ ptr = buffer+hdrlen;
+
+ if (notice->z_message_len+hdrlen > buffer_len)
+ return (ZERR_PKTLEN);
+
+ bcopy(notice->z_message,ptr,notice->z_message_len);
+
+ *len = hdrlen+notice->z_message_len;
+
+ if (*len > Z_MAXPKTLEN)
+ return (ZERR_PKTLEN);
+
+ return (ZERR_NONE);
+}