X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=sbr%2Futils.c;fp=sbr%2Futils.c;h=f450c58bca52df1ff4310d98b17a5ccd908207db;hp=3bde778e4ce775777b149e0eaf98cae356bc4ab9;hb=ced6090a330d3d83d0bce709f756aa3d7d65fea4;hpb=337338b404931f06f0db2119c9e145e8ca5a9860 diff --git a/sbr/utils.c b/sbr/utils.c index 3bde778..f450c58 100644 --- a/sbr/utils.c +++ b/sbr/utils.c @@ -1,10 +1,10 @@ /* - * utils.c -- various utility routines - * - * This code is Copyright (c) 2006, by the authors of nmh. See the - * COPYRIGHT file in the root directory of the nmh distribution for - * complete copyright information. - */ +** utils.c -- various utility routines +** +** This code is Copyright (c) 2006, by the authors of nmh. See the +** COPYRIGHT file in the root directory of the nmh distribution for +** complete copyright information. +*/ #include #include @@ -13,14 +13,14 @@ #include /* - * We allocate space for messages (msgs array) - * this number of elements at a time. - */ +** We allocate space for messages (msgs array) +** this number of elements at a time. +*/ #define MAXMSGS 256 /* - * Safely call malloc - */ +** Safely call malloc +*/ void * mh_xmalloc(size_t size) { @@ -37,8 +37,8 @@ mh_xmalloc(size_t size) } /* - * Safely call realloc - */ +** Safely call realloc +*/ void * mh_xrealloc(void *ptr, size_t size) { @@ -59,9 +59,9 @@ mh_xrealloc(void *ptr, size_t size) } /* - * Return the present working directory, if the current directory does not - * exist, or is too long, make / the pwd. - */ +** Return the present working directory, if the current directory does not +** exist, or is too long, make / the pwd. +*/ char * pwd(void) { @@ -85,13 +85,13 @@ pwd(void) } /* - * add -- If "s1" is NULL, this routine just creates a - * -- copy of "s2" into newly malloc'ed memory. - * -- - * -- If "s1" is not NULL, then copy the concatenation - * -- of "s1" and "s2" (note the order) into newly - * -- malloc'ed memory. Then free "s1". - */ +** add -- If "s1" is NULL, this routine just creates a +** -- copy of "s2" into newly malloc'ed memory. +** -- +** -- If "s1" is not NULL, then copy the concatenation +** -- of "s1" and "s2" (note the order) into newly +** -- malloc'ed memory. Then free "s1". +*/ char * add (char *s2, char *s1) { @@ -122,9 +122,9 @@ add (char *s2, char *s1) } /* - * folder_exists - * Check to see if a folder exists. - */ +** folder_exists +** Check to see if a folder exists. +*/ int folder_exists(char *folder) { @@ -132,9 +132,10 @@ folder_exists(char *folder) int exists = 0; if (stat (folder, &st) == -1) { - /* The folder either doesn't exist, or we hit an error. - * Either way return a failure. - */ + /* + ** The folder either doesn't exist, or we hit an error. + ** Either way return a failure. + */ exists = 0; } else { /* We can see a folder with the right name */ @@ -146,9 +147,9 @@ folder_exists(char *folder) /* - * create_folder - * Check to see if a folder exists, if not, prompt the user to create it. - */ +** create_folder +** Check to see if a folder exists, if not, prompt the user to create it. +*/ void create_folder(char *folder, int autocreate, void (*done_callback)(int)) { @@ -175,9 +176,9 @@ create_folder(char *folder, int autocreate, void (*done_callback)(int)) } /* - * num_digits - * Return the number of digits in a nonnegative integer. - */ +** num_digits +** Return the number of digits in a nonnegative integer. +*/ int num_digits (int n) { @@ -199,15 +200,16 @@ num_digits (int n) } /* - * Append a message arg to an array of them, resizing it if necessary. - * The function is written to suit the arg parsing code it was extracted - * from, and will probably be changed when the other code is cleaned up. - */ +** Append a message arg to an array of them, resizing it if necessary. +** The function is written to suit the arg parsing code it was extracted +** from, and will probably be changed when the other code is cleaned up. +*/ void app_msgarg(struct msgs_array *msgs, char *cp) { if(msgs->size >= msgs->max) - msgs->msgs = mh_xrealloc(msgs->msgs, (msgs->max+=MAXMSGS)*sizeof(*msgs->msgs)); + msgs->msgs = mh_xrealloc(msgs->msgs, + (msgs->max+=MAXMSGS)*sizeof(*msgs->msgs)); msgs->msgs[msgs->size++] = cp; }