*/
#include <h/mh.h>
+#include <h/utils.h>
#include <errno.h>
static struct swit switches[] = {
{ NULL, 0 }
};
-extern int errno;
-
static int fshort = 0; /* output only folder names */
static int fcreat = 0; /* should we ask to create new folders? */
static int fpack = 0; /* are we packing the folder? */
/* Allocate initial space to record folder names */
maxfolders = NUMFOLDERS;
- if ((folds = malloc (maxfolders * sizeof(char *))) == NULL)
- adios (NULL, "unable to allocate storage for folder names");
+ folds = mh_xmalloc (maxfolders * sizeof(char *));
/* Allocate initial space to record folder information */
maxFolderInfo = NUMFOLDERS;
- if ((fi = malloc (maxFolderInfo * sizeof(*fi))) == NULL)
- adios (NULL, "unable to allocate storage for folder info");
+ fi = mh_xmalloc (maxFolderInfo * sizeof(*fi));
/*
* Scan the folders
*/
if (total_folders >= maxFolderInfo) {
maxFolderInfo += NUMFOLDERS;
- if ((fi = realloc (fi, maxFolderInfo * sizeof(*fi))) == NULL)
- adios (NULL, "unable to re-allocate storage for folder info");
+ fi = mh_xrealloc (fi, maxFolderInfo * sizeof(*fi));
}
fi[i].name = fold;
/* if necessary, reallocate the space for folder names */
if (foldp >= maxfolders) {
maxfolders += NUMFOLDERS;
- if ((folds = realloc (folds, maxfolders * sizeof(char *))) == NULL)
- adios (NULL, "unable to re-allocate storage for folder names");
+ folds = mh_xrealloc (folds, maxfolders * sizeof(char *));
}
cp = getcpy (fold);
char atrcur[BUFSIZ];
register struct node *np;
- /* sanity check - check that context has been read */
- if (defpath == NULL)
- adios (NULL, "oops, context hasn't been read yet");
-
snprintf (atrcur, sizeof(atrcur), "atr-%s-", current);
atrlen = strlen (atrcur);