(msgs->max+=MAXMSGS)*sizeof(*msgs->msgs));
msgs->msgs[msgs->size++] = cp;
}
-
-/* Open a form or components file */
-int
-open_form(char **form, char *def)
-{
- int in;
- if (*form) {
- if ((in = open(etcpath(*form), O_RDONLY)) == NOTOK)
- adios(*form, "unable to open form file");
- } else {
- if ((in = open(etcpath(def), O_RDONLY)) == NOTOK)
- adios(def, "unable to open default components file");
- *form = def;
- }
- return in;
-}
char *form = NULL, *msg = NULL, buf[BUFSIZ], drft[BUFSIZ];
char **argp, **arguments;
struct msgs *mp = NULL;
+ char *nfs;
#ifdef LOCALE
setlocale(LC_ALL, "");
if (file && (msg || folder))
adios(NULL, "can't mix files and folders/msgs");
- in = open_form(&form, distcomps);
-
strncpy(drft, m_draft(seq_beyond), sizeof(drft));
-
if ((out = creat(drft, m_gmprot())) == NOTOK)
adios(drft, "unable to create");
- cpydata(in, out, form, drft);
- close(in);
+ nfs = new_fs(form, NULL, distcomps, NULL);
+ if (write(out, nfs, strlen(nfs)) != strlen(nfs)) {
+ adios(drft, "error writing");
+ }
close(out);
if (file) {