*/
#include <h/mh.h>
+#include <h/utils.h>
#include <fcntl.h>
#include <errno.h>
{ NULL, 0 }
};
-extern int errno;
-
static char maildir[BUFSIZ];
struct st_fold {
*/
nummsgs = 0;
maxmsgs = MAXMSGS;
- if (!(msgs = (char **) malloc ((size_t) (maxmsgs * sizeof(*msgs)))))
- adios (NULL, "unable to allocate storage");
+ msgs = (char **) mh_xmalloc ((size_t) (maxmsgs * sizeof(*msgs)));
/*
* Parse arguments
*/
if (nummsgs >= maxmsgs) {
maxmsgs += MAXMSGS;
- if (!(msgs = (char **) realloc (msgs,
- (size_t) (maxmsgs * sizeof(*msgs)))))
- adios (NULL, "unable to reallocate msgs storage");
+ msgs = (char **) mh_xrealloc (msgs,
+ (size_t) (maxmsgs * sizeof(*msgs)));
}
msgs[nummsgs++] = cp;
}
struct st_fold *fp, *ep;
for (fp = folders, ep = folders + nfolders; fp < ep; fp++) {
- if ((msgnum = folder_addmsg (&fp->f_mp, msgfile, 1, 0, preserve, nfolders == 1 && refile)) == -1)
+ if ((msgnum = folder_addmsg (&fp->f_mp, msgfile, 1, 0, preserve, nfolders == 1 && refile, maildir)) == -1)
return 1;
}
return 0;