* forw.c -- forward a message, or group of messages.
*
* $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 <fcntl.h>
#include <h/fmt_scan.h>
#include <h/tws.h>
+#include <h/utils.h>
#define IFORMAT "digest-issue-%s"
if (folder)
adios (NULL, "only one folder at a time!");
else
- folder = path (cp + 1, *cp == '+' ? TFOLDER : TSUBCWF);
+ folder = pluspath (cp);
} else {
msgs[msgp++] = cp;
}
if (!form)
form = digestcomps;
in = build_form (form, digest, volume, issue);
- } else {
- if (form) {
- if ((in = open (etcpath (form), O_RDONLY)) == NOTOK)
- adios (form, "unable to open form file");
- } else {
- if ((in = open (etcpath (forwcomps), O_RDONLY)) == NOTOK)
- adios (forwcomps, "unable to open default components file");
- form = forwcomps;
- }
- }
+ } else
+ in = open_form(&form, forwcomps);
if ((out = creat (drft, m_gmprot ())) == NOTOK)
adios (drft, "unable to create");
done (0);
what_now (ed, nedit, NOUSE, drft, NULL, 0, mp,
anot ? "Forwarded" : NULL, inplace, cwd);
- return done (1);
+ done (1);
+ return 1;
}
if (mp->numsel >= MAXARGS - i)
adios (NULL, "more than %d messages for %s exec",
- vec[0], MAXARGS - i);
+ MAXARGS - i, vec[0]);
/*
* Now add the message names to filter. We can only
if ((in = dup (fileno (tmp))) == NOTOK)
adios ("dup", "unable to");
- if ((line = malloc ((unsigned) fmtsize)) == NULL)
- adios (NULL, "unable to allocate format line storage");
+ line = mh_xmalloc ((unsigned) fmtsize);
fmt_scan (fmt, line, fmtsize, dat);
fputs (line, tmp);
free (line);