]> asedeno.scripts.mit.edu Git - 1ts-debian.git/blob - zephyr/lib/ZFmtSmRaw.c
cleanup various warnings from gcc -Wall
[1ts-debian.git] / zephyr / lib / ZFmtSmRaw.c
1 /* This file is part of the Project Athena Zephyr Notification System.
2  * It contains source for the ZFormatSmallRawNotice function.
3  *
4  *      Created by:     Robert French
5  *
6  *      $Id$
7  *
8  *      Copyright (c) 1987 by the Massachusetts Institute of Technology.
9  *      For copying and distribution information, see the file
10  *      "mit-copyright.h". 
11  */
12
13 #ifndef lint
14 static const char rcsid_ZFormatRawNotice_c[] = "$Id$";
15 #endif
16
17 #include <internal.h>
18
19 Code_t
20 ZFormatSmallRawNotice(ZNotice_t *notice,
21                       ZPacket_t buffer,
22                       int *ret_len)
23 {
24     Code_t retval;
25     int hdrlen;
26     
27     if ((retval = Z_FormatRawHeader(notice, buffer, Z_MAXHEADERLEN,
28                                     &hdrlen, NULL, NULL)) != ZERR_NONE)
29         return (retval);
30
31     *ret_len = hdrlen+notice->z_message_len;
32
33     if (*ret_len > Z_MAXPKTLEN)
34         return (ZERR_PKTLEN);
35
36     (void) memcpy(buffer+hdrlen, notice->z_message, notice->z_message_len);
37
38     return (ZERR_NONE);
39 }
40
41 Code_t
42 ZNewFormatSmallRawNotice(ZNotice_t *notice,
43                          ZPacket_t buffer,
44                          int *ret_len)
45 {
46   Code_t retval;
47   int hdrlen;
48   
49   if ((retval = Z_AsciiFormatRawHeader(notice, buffer, Z_MAXHEADERLEN,
50                                        &hdrlen, NULL, NULL, NULL, NULL)) 
51       != ZERR_NONE)
52     return (retval);
53   
54   *ret_len = hdrlen+notice->z_message_len;
55   
56   if (*ret_len > Z_MAXPKTLEN)
57     return (ZERR_PKTLEN);
58   
59   (void) memcpy(buffer+hdrlen, notice->z_message, notice->z_message_len);
60   
61   return (ZERR_NONE);
62 }