]> asedeno.scripts.mit.edu Git - 1ts-debian.git/blob - zephyr/zwgc/notice.h
r4264@bucket (orig r254): kcr | 2008-01-20 22:11:44 -0500
[1ts-debian.git] / zephyr / zwgc / notice.h
1 /* This file is part of the Project Athena Zephyr Notification System.
2  * It is one of the source files comprising zwgc, the Zephyr WindowGram
3  * client.
4  *
5  *      Created by:     Marc Horowitz <marc@athena.mit.edu>
6  *
7  *      $Id$
8  *
9  *      Copyright (c) 1989 by the Massachusetts Institute of Technology.
10  *      For copying and distribution information, see the file
11  *      "mit-copyright.h".
12  */
13
14
15 #include <zephyr/mit-copyright.h>
16
17 #ifndef notice_MODULE
18 #define notice_MODULE
19
20 #include <zephyr/zephyr.h>
21 #include "new_string.h"
22
23 /*
24  *    int count_nulls(char *data, int length)
25  *        Requires: length>=0
26  *        Effects: Returns the # of nulls in data[0]..data[length-1]
27  */
28
29 extern int count_nulls(char *, int);
30
31 /*
32  *    string get_next_field(char **data_p, int *length_p)
33  *        Requires: *length_p >= 0
34  *        Modifies: *data_p, *length_p
35  *        Effects: Treats (*data_p)[0], (*data_p)[1], ... (*data_p)[length-1]
36  *                 as a series of null-seperated fields.  This function
37  *                 returns a copy of the first field on the heap.  This
38  *                 string must eventually be freed.  Also, *data_p is
39  *                 advanced and *length_p decreased so that another
40  *                 call to this procedure with the same arguments will
41  *                 return the second field.  The next call will return
42  *                 the third field, etc.  "" is returned if 0 fields
43  *                 remain.  (this is the case when *length_p == 0)
44  */
45
46 extern string get_next_field(char **, int *);
47
48 /*
49  *    string get_field(char *data, int length, int num)
50  *        Requires: length>=0, num>0
51  *        Effects: Treats data[0]..data[length-1] as a series of
52  *                 null-seperated fields.  This function returns a copy of
53  *                 the num'th field (numbered from 1 in this case) on the
54  *                 heap.  This string must eventually be freed.  If there
55  *                 is no num'th field (because num<1 or num># of fields),
56  *                 "" is returned.
57  */
58
59 extern string get_field(char *, int, int);
60
61 /*
62  *    string convert_nulls_to_newlines(data, length)
63  *       Requires: length>=0, malloc never returns NULL
64  *       Effects: Takes data[0]..data[length-1], converts all nulls to
65  *                newlines ('\n') and returns the result as a null-terminated
66  *                string on the heap.  The returned string must eventually
67  *                be freed.
68  */
69
70 extern string convert_nulls_to_newlines(char *, int);
71
72
73 extern char *decode_notice(ZNotice_t *, char *);
74
75 #endif