]>
diplodocus.org Git - nmh/blob - h/utils.h
95cae88cff871b1f31049e158d61547faa9bb15c
3 * utils.h -- utility prototypes
6 /* Call malloc(3), exiting on NULL return. */
7 void *mh_xmalloc(size_t);
9 /* Call realloc(3), exiting on NULL return. */
10 void *mh_xrealloc(void *, size_t);
12 /* Call calloc(3), exiting on NULL return. */
13 void *mh_xcalloc(size_t, size_t);
15 /* Call free(3), if ptr isn't NULL. */
16 void mh_xfree(void *ptr
);
19 char *add(const char *, char *);
20 char *addlist(char *, const char *);
21 int folder_exists(const char *);
22 void create_folder(char *, int, void (*)(int));
26 * A vector of char array, used to hold a list of string message numbers
27 * or command arguments.
36 * Same as msgs_array, but for a vector of ints
45 * Add a argument to the given msgs_array or msgnum_array structure; extend
46 * the array size if necessary
49 void app_msgarg(struct msgs_array
*, char *);
50 void app_msgnum(struct msgnum_array
*, int);
52 int open_form(char **, char *);
53 char *find_str (const char [], size_t, const char *);
54 char *rfind_str (const char [], size_t, const char *);
55 char *nmh_strcasestr (const char *, const char *);
58 * See if a string contains 8 bit characters (use isascii() for the test).
61 * start - Pointer to start of string to test.
62 * end - End of string to test (test will stop before reaching
63 * this point). If NULL, continue until reaching '\0'.
65 * This function always stops at '\0' regardless of the value of 'end'.
66 * Returns 1 if the string contains an 8-bit character, 0 if it does not.
68 int contains8bit(const char *start
, const char *end
);
71 * See if file has any 8-bit bytes.
74 * fd - file descriptor
75 * eightbit - address of result, will be set to 1 if the file contains
76 * any 8-bit bytes, 0 otherwise.
78 * Returns OK on success, NOTOK on read failure.
81 int scan_input (int fd
, int *eightbit
);
85 * Compares prior version of nmh with current version. Returns 1
86 * if they compare the be the same, 0 if not.
88 * older - 0 for difference comparison, 1 for only if older
90 int nmh_version_changed (int older
);