#include <h/mh.h>
#include <fcntl.h>
-#include <h/signals.h>
#include <h/md5.h>
#include <h/mts.h>
#include <h/tws.h>
mhstoreinfo_t
mhstoreinfo_create (CT *ct, char *pwd, const char *csw, int asw, int vsw) {
- mhstoreinfo_t info = mh_xmalloc (sizeof *info);
+ mhstoreinfo_t info;
+ NEW(info);
info->cts = ct;
info->cwd = pwd;
info->autosw = asw;
/* mhmisc.c */
-int part_ok (CT, int);
+int part_ok (CT);
int type_ok (CT, int);
void flush_errors (void);
* store any contents.
*/
if ((cp = context_find (nmhstorage)) && *cp)
- info->dir = getcpy (cp);
+ info->dir = mh_xstrdup(cp);
else
info->dir = getcpy (info->cwd);
for (part = m->mp_parts; part; part = part->mp_next) {
CT p = part->mp_part;
- if (part_ok (p, 1) && type_ok (p, 1)) {
+ if (part_ok (p) && type_ok (p, 1)) {
if (ct->c_storage) {
/* Support mhstore -outfile. The MIME parser doesn't
load c_storage, so we know that p->c_storage is
return NOTOK;
}
- if ((base = (CT *) mh_xcalloc ((size_t) (i + 1), sizeof(*base))) == NULL)
- adios (NULL, "out of memory");
-
+ base = mh_xcalloc(i + 1, sizeof *base);
ctq = base;
for (ctp = info->cts; *ctp; ctp++) {
p = *ctp;
/* Read the folder. */
if ((mp = folder_read (folder, 0))) {
/* Link file into folder */
- msgnum = folder_addmsg (&mp, filename, 0, 0, 0, 0, (char *)0);
+ msgnum = folder_addmsg (&mp, filename, 0, 0, 0, 0, NULL);
} else {
advise (NULL, "unable to read folder %s", folder);
return NOTOK;
if (isatty (fileno (stdin))) {
char *prompt =
concat ("Overwrite \"", file, "\" [y/n/rename]? ", NULL);
- ans = getans (prompt, answer);
+ ans = read_switch_multiword (prompt, answer);
free (prompt);
} else {
/* Overwrite, that's what nmh used to do. And warn. */
file = NULL;
++info->files_not_clobbered;
} else {
- char *newline = strchr (buf, '\n');
- if (newline) {
- *newline = '\0';
- }
+ TrimSuffixC(buf, '\n');
}
free (file);