Replaced open_form() with new_fs() in forw.c.
authormarkus schnalke <meillo@marmaro.de>
Thu, 9 Feb 2012 19:48:26 +0000 (20:48 +0100)
committermarkus schnalke <meillo@marmaro.de>
Thu, 9 Feb 2012 19:48:26 +0000 (20:48 +0100)
uip/forw.c

index feb60f9..38ede22 100644 (file)
@@ -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) {