]> diplodocus.org Git - nmh/blob - h/utils.h
Added NMH_ADDL_CPPFLAGS macro in new m4/cppflags.m4, to remove
[nmh] / h / utils.h
1
2 /*
3 * utils.h -- utility prototypes
4 */
5
6 void *mh_xmalloc(size_t);
7 void *mh_xrealloc(void *, size_t);
8 void *mh_xcalloc(size_t, size_t);
9 char *pwd(void);
10 char *add(const char *, char *);
11 char *addlist(char *, const char *);
12 int folder_exists(const char *);
13 void create_folder(char *, int, void (*)(int));
14 int num_digits(int);
15
16 /*
17 * A vector of char array, used to hold a list of string message numbers
18 * or command arguments.
19 */
20
21 struct msgs_array {
22 int max, size;
23 char **msgs;
24 };
25
26 /*
27 * Same as msgs_array, but for a vector of ints
28 */
29
30 struct msgnum_array {
31 int max, size;
32 int *msgnums;
33 };
34
35 /*
36 * Add a argument to the given msgs_array or msgnum_array structure; extend
37 * the array size if necessary
38 */
39
40 void app_msgarg(struct msgs_array *, char *);
41 void app_msgnum(struct msgnum_array *, int);
42
43 int open_form(char **, char *);
44 char *find_str (const char [], size_t, const char *);
45 char *rfind_str (const char [], size_t, const char *);
46 char *nmh_strcasestr (const char *, const char *);
47
48 /*
49 * See if a string contains 8 bit characters (use isascii() for the test).
50 * Arguments include:
51 *
52 * start - Pointer to start of string to test.
53 * end - End of string to test (test will stop before reaching
54 * this point). If NULL, continue until reaching '\0'.
55 *
56 * This function always stops at '\0' regardless of the value of 'end'.
57 * Returns 1 if the string contains an 8-bit character, 0 if it does not.
58 */
59 int contains8bit(const char *start, const char *end);