int isdf = 0, nedit = 0, use = 0, atfile = 1;
char *cp, *dfolder = NULL, *dmsg = NULL;
char *ed = NULL, *drft = NULL, *msgnam = NULL;
- char buf[BUFSIZ], prompt[BUFSIZ];
+ char buf[BUFSIZ];
char **argp, **arguments;
struct stat st;
char cwd[PATH_MAX + 1]; /* current working directory */
ambigsw (cp, whatnowswitches);
done (1);
case UNKWNSW:
- adios (NULL, "-%s unknown", cp);
+ die("-%s unknown", cp);
case HELPSW:
snprintf (buf, sizeof(buf), "%s [switches] [file]", invo_name);
case DFOLDSW:
if (dfolder)
- adios (NULL, "only one draft folder at a time!");
+ die("only one draft folder at a time!");
if (!(cp = *argp++) || *cp == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
+ die("missing argument to %s", argp[-2]);
dfolder = path (*cp == '+' || *cp == '@' ? cp + 1 : cp,
*cp != '@' ? TFOLDER : TSUBCWF);
continue;
case DMSGSW:
if (dmsg)
- adios (NULL, "only one draft message at a time!");
+ die("only one draft message at a time!");
if (!(dmsg = *argp++) || *dmsg == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
+ die("missing argument to %s", argp[-2]);
continue;
case NDFLDSW:
dfolder = NULL;
case EDITRSW:
if (!(ed = *argp++) || *ed == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
+ die("missing argument to %s", argp[-2]);
nedit = 0;
continue;
case NEDITSW:
case PRMPTSW:
if (!(myprompt = *argp++) || *myprompt == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
+ die("missing argument to %s", argp[-2]);
continue;
}
}
if (drft)
- adios (NULL, "only one draft at a time!");
+ die("only one draft at a time!");
drft = cp;
}
if ((drft == NULL && (drft = getenv ("mhdraft")) == NULL) || *drft == 0)
- drft = getcpy (m_draft (dfolder, dmsg, 1, &isdf));
+ drft = mh_xstrdup(m_draft(dfolder, dmsg, 1, &isdf));
msgnam = (cp = getenv ("mhaltmsg")) && *cp ? mh_xstrdup(cp) : NULL;
NULL, 1, atfile) < 0)
done (1);
- snprintf (prompt, sizeof(prompt), myprompt, invo_name);
for (;;) {
#ifdef READLINE_SUPPORT
- if (!(argp = read_switch_multiword_via_readline (prompt, aleqs))) {
+ if (!(argp = read_switch_multiword_via_readline(myprompt, aleqs))) {
#else /* ! READLINE_SUPPORT */
- if (!(argp = read_switch_multiword (prompt, aleqs))) {
+ if (!(argp = read_switch_multiword(myprompt, aleqs))) {
#endif /* READLINE_SUPPORT */
(void) m_unlink (LINK);
done (1);
*/
int trailln = strlen(trailcmd) + 4;
if (ln < 0 || ln + trailln > bufsz)
- adios(NULL, "arguments too long");
+ die("arguments too long");
cp = buf + ln;
ln = strlen(*argp);
/* +1 for leading space */
if (ln + trailln + 1 > bufsz - (cp-buf))
- adios(NULL, "arguments too long");
+ die("arguments too long");
*cp++ = ' ';
memcpy(cp, *argp, ln+1);
cp += ln;
while (argp[i])
i++;
}
- args = (char **) mh_xmalloc((i + 2) * sizeof(char *));
+ args = mh_xmalloc((i + 2) * sizeof(char *));
/*
* For backward compatibility, we need to add -build
vec = argsplit(postproc, &program, &vecp);
vec[vecp++] = "-library";
- vec[vecp++] = getcpy (m_maildir (""));
+ vec[vecp++] = mh_xstrdup(m_maildir(""));
if ((cp = context_find ("fileproc"))) {
vec[vecp++] = "-fileproc";
case AUTHSERVICESW:
#ifdef OAUTH_SUPPORT
if (!(auth_svc = *argp++) || *auth_svc == '-')
- adios (NULL, "missing argument to %s", argp[-2]);
+ die("missing argument to %s", argp[-2]);
#else
NMH_UNUSED (user);
NMH_UNUSED (auth_svc);
- adios (NULL, "not built with OAuth support");
+ die("not built with OAuth support");
#endif
continue;
&& altmsg) {
vec[vecp++] = "-dist";
if ((cp = m_mktemp2(altmsg, invo_name, NULL, NULL)) == NULL) {
- adios(NULL, "unable to create temporary file");
+ die("unable to create temporary file");
}
distfile = mh_xstrdup(cp);
(void) m_unlink(distfile);
#ifdef OAUTH_SUPPORT
if (auth_svc == NULL) {
if (saslmech && ! strcasecmp(saslmech, "xoauth2")) {
- adios (NULL, "must specify -authservice with -saslmech xoauth2");
+ die("must specify -authservice with -saslmech xoauth2");
}
} else {
if (user == NULL) {
- adios (NULL, "must specify -user with -saslmech xoauth2");
+ die("must specify -user with -saslmech xoauth2");
}
}
#else