- }
- if (!p)
- continue;
-
- if ((part = (struct part *) calloc (1, sizeof(*part))) == NULL)
- adios (NULL, "out of memory");
- *pp = part;
- pp = &part->mp_next;
- part->mp_part = p;
- }
- admonish (NULL, "premature end-of-file, missing #end");
- return OK;
- }
-
- /*
- * Unknown directive
- */
- adios (NULL, "unknown directive \"#%s\"", ci->ci_type);
- return NOTOK; /* NOT REACHED */
-}
-
-
-static void
-set_id (CT ct, int top)
-{
- char msgid[BUFSIZ];
- static int partno;
- static time_t clock = 0;
- static char *msgfmt;
-
- if (clock == 0) {
- time (&clock);
- snprintf (msgid, sizeof(msgid), "<%d.%ld.%%d@%s>\n",
- (int) getpid(), (long) clock, LocalName());
- partno = 0;
- msgfmt = getcpy(msgid);
- }
- snprintf (msgid, sizeof(msgid), msgfmt, top ? 0 : ++partno);
- ct->c_id = getcpy (msgid);
-}
-
-
-static char ebcdicsafe[0x100] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01,
- 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
-};
-
-
-/*
- * Fill out, or expand the various contents in the composition
- * draft. Read-in any necessary files. Parse and execute any
- * commands specified by profile composition strings.
- */
-
-static int
-compose_content (CT ct)
-{
- CE ce = ct->c_cefile;
-
- switch (ct->c_type) {
- case CT_MULTIPART:
- {
- int partnum;
- char *pp;
- char partnam[BUFSIZ];
- struct multipart *m = (struct multipart *) ct->c_ctparams;
- struct part *part;
-
- if (ct->c_partno) {
- snprintf (partnam, sizeof(partnam), "%s.", ct->c_partno);
- pp = partnam + strlen (partnam);
- } else {
- pp = partnam;
- }
-
- /* first, we call compose_content on all the subparts */
- for (part = m->mp_parts, partnum = 1; part; part = part->mp_next, partnum++) {
- CT p = part->mp_part;
-
- sprintf (pp, "%d", partnum);
- p->c_partno = add (partnam, NULL);
- if (compose_content (p) == NOTOK)
- return NOTOK;
- }