From: markus schnalke Date: Thu, 9 Feb 2012 19:48:26 +0000 (+0100) Subject: Replaced open_form() with new_fs() in forw.c. X-Git-Tag: mmh-thesis-end~330 X-Git-Url: http://git.marmaro.de/?p=mmh;a=commitdiff_plain;h=003cacd23c8f80054990c5ad3303f9a115241583 Replaced open_form() with new_fs() in forw.c. --- diff --git a/uip/forw.c b/uip/forw.c index feb60f9..38ede22 100644 --- a/uip/forw.c +++ b/uip/forw.c @@ -73,6 +73,7 @@ main(int argc, char **argv) char *folder = NULL; char *form = NULL, buf[BUFSIZ], value[10]; char **argp, **arguments, *msgs[MAXARGS]; + char *nfs; #ifdef MHE int buildsw = 0; @@ -213,6 +214,9 @@ main(int argc, char **argv) done(1); seq_setprev(mp); /* set the previous sequence */ + if ((out = creat(drft, m_gmprot())) == NOTOK) + adios(drft, "unable to create"); + /* Open form (component) file. */ if (digest) { if (issue == 0) { @@ -230,18 +234,16 @@ main(int argc, char **argv) if (!form) form = digestcomps; in = build_form(form, digest, volume, issue); - } else - in = open_form(&form, forwcomps); - - if ((out = creat(drft, m_gmprot())) == NOTOK) - adios(drft, "unable to create"); - - /* - ** copy the components into the draft - */ - cpydata(in, out, form, drft); - close(in); + cpydata(in, out, form, drft); + close(in); + } else { + nfs = new_fs(form, NULL, forwcomps, NULL); + if (write(out, nfs, strlen(nfs)) != strlen(nfs)) { + adios(drft, "error writing"); + } + } close(out); + add_forw_hdr(drft); if (digest) {