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
5 * Created by: Marc Horowitz <marc@athena.mit.edu>
7 * $Id: notice.h,v 1.5 1999/01/22 23:20:29 ghudson Exp $
9 * Copyright (c) 1989 by the Massachusetts Institute of Technology.
10 * For copying and distribution information, see the file
15 #include <zephyr/mit-copyright.h>
20 #include "new_string.h"
23 * int count_nulls(char *data, int length)
25 * Effects: Returns the # of nulls in data[0]..data[length-1]
28 extern int count_nulls();
31 * string get_next_field(char **data_p, int *length_p)
32 * Requires: *length_p >= 0
33 * Modifies: *data_p, *length_p
34 * Effects: Treats (*data_p)[0], (*data_p)[1], ... (*data_p)[length-1]
35 * as a series of null-seperated fields. This function
36 * returns a copy of the first field on the heap. This
37 * string must eventually be freed. Also, *data_p is
38 * advanced and *length_p decreased so that another
39 * call to this procedure with the same arguments will
40 * return the second field. The next call will return
41 * the third field, etc. "" is returned if 0 fields
42 * remain. (this is the case when *length_p == 0)
45 extern string get_next_field();
48 * string get_field(char *data, int length, int num)
49 * Requires: length>=0, num>0
50 * Effects: Treats data[0]..data[length-1] as a series of
51 * null-seperated fields. This function returns a copy of
52 * the num'th field (numbered from 1 in this case) on the
53 * heap. This string must eventually be freed. If there
54 * is no num'th field (because num<1 or num># of fields),
58 extern string get_field();
61 * string convert_nulls_to_newlines(data, length)
62 * Requires: length>=0, malloc never returns NULL
63 * Effects: Takes data[0]..data[length-1], converts all nulls to
64 * newlines ('\n') and returns the result as a null-terminated
65 * string on the heap. The returned string must eventually
69 extern string convert_nulls_to_newlines();
72 extern char *decode_notice();