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/ZFmtNotice.c | |
parent | 2a79930d731c6d85df0fc46e869a4466dbf1d1fd (diff) |
Initial revision
Diffstat (limited to 'lib/ZFmtNotice.c')
-rw-r--r-- | lib/ZFmtNotice.c | 45 |
1 files changed, 45 insertions, 0 deletions
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 <zephyr/mit-copyright.h> + +#include <zephyr/zephyr.h> + +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); +} |