* popi.c -- POP initiator for MPOP
*
* $Id$
+ *
+ * This code is Copyright (c) 2002, 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/fmt_scan.h>
#include <h/scansbr.h>
#include <h/mts.h>
+#include <h/utils.h>
#include <errno.h>
#ifndef RPOP
static char *nfs = NULL;
static struct msgs *mp;
-extern int errno;
extern char response[];
/*
if (folder)
adios (NULL, "only one folder at a time!");
else
- folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+ folder = pluspath (cp);
}
else
adios (NULL, "usage: %s [+folder] [switches]", invo_name);
}
snprintf (mailname, sizeof(mailname), "PO box for %s@%s", user, host);
- if (pop_init (host, user, pass, snoop, rpop) == NOTOK)
+ if (pop_init (host, user, pass, NULL, snoop, rpop) == NOTOK)
adios (NULL, "%s", response);
if (rpop > 0)
setuid (getuid ());
folder = getfolder (0);
maildir = m_maildir (folder);
- if (stat (maildir, &st) == NOTOK) {
- if (errno != ENOENT)
- adios (maildir, "error on folder");
- cp = concat ("Create folder \"", maildir, "\"? ", NULL);
- if (noisy && !getanswer (cp))
- done (1);
- free (cp);
- if (!makedir (maildir))
- adios (NULL, "unable to create folder %s", maildir);
- }
+ create_folder(maildir, 0, done);
if (chdir (maildir) == NOTOK)
adios (maildir, "unable to change directory to");
if (*dp == '\\' || *dp == '"' || *dp == '\n')
i++;
i++;
- if ((ep = malloc ((unsigned) i)) == NULL)
- adios (NULL, "out of memory");
+ ep = mh_xmalloc ((unsigned) i);
for (dp = nfs, fp = ep; *dp; dp++) {
if (*dp == '\n') {
*fp++ = '\\', *fp++ = 'n';