X-Git-Url: http://git.marmaro.de/?a=blobdiff_plain;f=uip%2Fforw.c;h=93870b1af0c5c91e9cf1bc9738adb7536de5ccf4;hb=43d85eaa38c25385082958d831fc926c5e619eac;hp=ade775ed90d0e3621d9a86da9582811d5b08f699;hpb=1691e80890e5d8ba258c51c214a3e91880e1db2b;p=mmh diff --git a/uip/forw.c b/uip/forw.c index ade775e..93870b1 100644 --- a/uip/forw.c +++ b/uip/forw.c @@ -3,12 +3,17 @@ * 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 #include #include -#include +#include +#include #define IFORMAT "digest-issue-%s" @@ -62,13 +67,13 @@ static struct swit switches[] = { #define VERSIONSW 22 { "version", 0 }, #define HELPSW 23 - { "help", 4 }, + { "help", 0 }, #define FILESW 24 - { "file file", -4 }, /* interface from msh */ + { "file file", 4 }, /* interface from msh */ #ifdef MHE #define BILDSW 25 - { "build", -5 }, /* interface from mhe */ + { "build", 5 }, /* interface from mhe */ #endif /* MHE */ { NULL, 0 } @@ -388,16 +393,8 @@ try_it_again: 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"); @@ -447,7 +444,7 @@ try_it_again: done (0); what_now (ed, nedit, NOUSE, drft, NULL, 0, mp, anot ? "Forwarded" : NULL, inplace, cwd); - done (1); + return done (1); } @@ -684,8 +681,7 @@ build_form (char *form, char *digest, int volume, int issue) 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);