From 140725197bc779a27b98fae5d992a3512097adf0 Mon Sep 17 00:00:00 2001 From: "Robert S. French" Date: Fri, 12 Jun 1987 13:01:26 +0000 Subject: Initial revision --- lib/ZFmtNotice.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 lib/ZFmtNotice.c (limited to 'lib/ZFmtNotice.c') diff --git a/lib/ZFmtNotice.c b/lib/ZFmtNotice.c new file mode 100644 index 0000000..e1d3e7b --- /dev/null +++ b/lib/ZFmtNotice.c @@ -0,0 +1,45 @@ +/* This file is part of the Project Athena Zephyr Notification System. + * It contains source for the ZFormatNotice 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 + +#include + +Code_t ZFormatNotice(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_FormatHeader(notice,buffer,buffer_len,&hdrlen)) > 0) + 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); +} -- cgit v1.2.3