/*
- * 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 <h/mh.h>
#include <h/utils.h>
#include <errno.h>
/*
- * 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)
{
}
/*
- * Safely call realloc
- */
+** Safely call realloc
+*/
void *
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)
{
}
/*
- * 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)
{
}
/*
- * folder_exists
- * Check to see if a folder exists.
- */
+** folder_exists
+** Check to see if a folder exists.
+*/
int
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 */
/*
- * 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))
{
}
/*
- * 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)
{
}
/*
- * 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;
}