}
/* get copies of the buffers */
- np = add(name, NULL);
- vp = add(buf, NULL);
+ np = getcpy(name);
+ vp = getcpy(buf);
/* if necessary, get rest of field */
while (state == FLDPLUS) {
** Now add the MIME-Version header field
** to the list of header fields.
*/
- np = add(VRSN_FIELD, NULL);
+ np = getcpy(VRSN_FIELD);
vp = concat(" ", VRSN_VALUE, "\n", NULL);
add_header(ct, np, vp);
done(1);
ct->c_type = CT_MULTIPART;
ct->c_subtype = MULTI_MIXED;
- ct->c_file = add(infile, NULL);
+ ct->c_file = getcpy(infile);
if ((m = (struct multipart *) calloc(1, sizeof(*m))) == NULL)
adios(NULL, "out of memory");
adios("mhbuildsbr", "unable to create temporary file");
/* use a temp file to collect the plain text lines */
- ce->ce_file = add(cp, NULL);
+ ce->ce_file = getcpy(cp);
ce->ce_unlink = 1;
if (buf[0] == '#' && buf[1] == '<') {
continue;
if (!*cp)
adios(NULL, "empty pipe command for #%s directive", ci->ci_type);
- cp = add(cp, NULL);
+ cp = getcpy(cp);
free(ci->ci_magic);
ci->ci_magic = cp;
} else {
done(1);
}
}
- ci->ci_magic = add(cp, NULL);
+ ci->ci_magic = getcpy(cp);
return OK;
}
ap = brkstring(ci->ci_magic, " ", "\n");
copyip(ap, arguments, MAXARGS);
} else {
- arguments[0] = "cur";
+ arguments[0] = seq_cur;
arguments[1] = NULL;
}
folder = NULL;
if (folder)
adios(NULL, "only one folder per #forw directive");
else
- folder = pluspath(cp);
+ folder = getcpy(expandfol(cp));
}
}
/* else, use the current folder */
if (!folder)
- folder = add(getfolder(FCUR), NULL);
+ folder = getcpy(getcurfol());
if (!(mp = folder_read(folder)))
adios(NULL, "unable to read folder %s", folder);
snprintf(buffer, sizeof(buffer),
"%s/%d", mp->foldpath,
msgnum);
- pe->ce_file = add(buffer, NULL);
+ pe->ce_file = getcpy(buffer);
if (listsw && stat(pe->ce_file, &st)
!= NOTOK)
p->c_end = (long) st.st_size;
msgnum = mp->lowsel;
snprintf(buffer, sizeof(buffer), "%s/%d",
mp->foldpath, msgnum);
- ce->ce_file = add(buffer, NULL);
+ ce->ce_file = getcpy(buffer);
if (listsw && stat(ce->ce_file, &st) != NOTOK)
ct->c_end = (long) st.st_size;
}
CT p = part->mp_part;
sprintf(pp, "%d", partnum);
- p->c_partno = add(partnam, NULL);
+ p->c_partno = getcpy(partnam);
if (compose_content(p) == NOTOK)
return NOTOK;
}
if (tfile == NULL) {
adios("mhbuildsbr", "unable to create temporary file");
}
- ce->ce_file = add(tfile, NULL);
+ ce->ce_file = getcpy(tfile);
ce->ce_unlink = 1;
xstdout = 0;
if ((out = fopen(ce->ce_file, "w")) == NULL)
adios(ce->ce_file, "unable to open for writing");
- for (i = 0; (child_id = vfork()) == NOTOK && i > 5; i++)
+ for (i = 0; (child_id = fork()) == NOTOK && i > 5; i++)
sleep(5);
switch (child_id) {
case NOTOK:
if (!isspace(*cp))
break;
*++cp = '\0';
- if (!strncmp(buffer + 2, prefix, len) &&
+ if (strncmp(buffer + 2, prefix, len)==0 &&
isdigit(buffer[2 + len])) {
boundaryclash = 1;
/* no need to keep checking */
NULL);
} else {
t->tx_charset = CHARSET_USASCII;
- *ap = add("charset=us-ascii", NULL);
+ *ap = getcpy("charset=us-ascii");
}
cp = strchr(*ap++, '=');
ep = ci->ci_values;
snprintf(buffer, sizeof(buffer), "boundary=%s%d",
prefix, level++);
- cp = strchr(*ap++ = add(buffer, NULL), '=');
+ cp = strchr(*ap++ = getcpy(buffer), '=');
*ap = NULL;
*cp++ = '\0';
*ep = cp;
/*
** output the content type and subtype
*/
- np = add(TYPE_FIELD, NULL);
+ np = getcpy(TYPE_FIELD);
vp = concat(" ", ci->ci_type, "/", ci->ci_subtype, NULL);
/* keep track of length of line */
** output the Content-ID, unless disabled by -nocontentid
*/
if (contentidsw && ct->c_id) {
- np = add(ID_FIELD, NULL);
+ np = getcpy(ID_FIELD);
vp = concat(" ", ct->c_id, NULL);
add_header(ct, np, vp);
}
** output the Content-Description
*/
if (ct->c_descr) {
- np = add(DESCR_FIELD, NULL);
+ np = getcpy(DESCR_FIELD);
vp = concat(" ", ct->c_descr, NULL);
add_header(ct, np, vp);
}
** output the Content-Disposition
*/
if (ct->c_dispo) {
- np = add(DISPO_FIELD, NULL);
+ np = getcpy(DISPO_FIELD);
vp = concat(" ", ct->c_dispo, NULL);
add_header(ct, np, vp);
}
** output the Content-MD5
*/
if (checksw) {
- np = add(MD5_FIELD, NULL);
+ np = getcpy(MD5_FIELD);
vp = calculate_digest(ct, (ct->c_encoding == CE_QUOTED) ?
1 : 0);
add_header(ct, np, vp);
case CE_7BIT:
/* Nothing to output */
#if 0
- np = add(ENCODING_FIELD, NULL);
+ np = getcpy(ENCODING_FIELD);
vp = concat(" ", "7bit", "\n", NULL);
add_header(ct, np, vp);
#endif
if (ct->c_type == CT_MESSAGE)
adios(NULL, "internal error, invalid encoding");
- np = add(ENCODING_FIELD, NULL);
+ np = getcpy(ENCODING_FIELD);
vp = concat(" ", "8bit", "\n", NULL);
add_header(ct, np, vp);
break;
if (ct->c_type == CT_MESSAGE || ct->c_type == CT_MULTIPART)
adios(NULL, "internal error, invalid encoding");
- np = add(ENCODING_FIELD, NULL);
+ np = getcpy(ENCODING_FIELD);
vp = concat(" ", "quoted-printable", "\n", NULL);
add_header(ct, np, vp);
break;
if (ct->c_type == CT_MESSAGE || ct->c_type == CT_MULTIPART)
adios(NULL, "internal error, invalid encoding");
- np = add(ENCODING_FIELD, NULL);
+ np = getcpy(ENCODING_FIELD);
vp = concat(" ", "base64", "\n", NULL);
add_header(ct, np, vp);
break;
if (ct->c_type == CT_MESSAGE)
adios(NULL, "internal error, invalid encoding");
- np = add(ENCODING_FIELD, NULL);
+ np = getcpy(ENCODING_FIELD);
vp = concat(" ", "binary", "\n", NULL);
add_header(ct, np, vp);
break;