if ((cp = context_find(nmhstorage)) && *cp)
tmp = concat(cp, "/", invo_name, NULL);
else
- tmp = getcpy(toabsdir(invo_name));
+ tmp = mh_xstrdup(toabsdir(invo_name));
/* Check if we have a file to process */
if (!compfile)
/*
** Allocate space for primary (outside) content
*/
- ct = (CT) mh_xcalloc(1, sizeof(*ct));
+ ct = mh_xcalloc(1, sizeof(*ct));
/*
** Allocate structure for handling decoded content
}
/* add the header data to the list */
- add_header(ct, getcpy(f.name), getcpy(f.value));
+ add_header(ct, mh_xstrdup(f.name), mh_xstrdup(f.value));
continue;
case LENERR2:
case FMTERR2:
- case ERR2:
+ case IOERR2:
adios(EX_CONFIG, NULL, "message format error in component #%d",
compnum);
** Now add the MIME-Version header field
** to the list of header fields.
*/
- np = getcpy(VRSN_FIELD);
+ np = mh_xstrdup(VRSN_FIELD);
vp = concat(" ", VRSN_VALUE, "\n", NULL);
add_header(ct, np, vp);
/*
- ** We initally assume we will find multiple contents in the
+ ** We initially assume we will find multiple contents in the
** draft. So create a multipart/mixed content to hold everything.
** We can remove this later, if it is not needed.
*/
}
ct->c_type = CT_MULTIPART;
ct->c_subtype = MULTI_MIXED;
- ct->c_file = getcpy(infile);
+ ct->c_file = mh_xstrdup(infile);
m = (struct multipart *) mh_xcalloc(1, sizeof(*m));
ct->c_ctparams = (void *) m;
if (!p)
continue;
- part = (struct part *) mh_xcalloc(1, sizeof(*part));
+ part = mh_xcalloc(1, sizeof(*part));
*pp = part;
pp = &part->mp_next;
part->mp_part = p;
{
CE ce;
- ce = (CE) mh_xcalloc(1, sizeof(*ce));
+ ce = mh_xcalloc(1, sizeof(*ce));
ct->c_cefile = ce;
ct->c_ceopenfnx = open7Bit; /* since unencoded */
}
/* allocate basic Content structure */
- ct = (CT) mh_xcalloc(1, sizeof(*ct));
+ ct = mh_xcalloc(1, sizeof(*ct));
*ctp = ct;
/* allocate basic structure for handling decoded content */
adios(EX_CANTCREAT, "mhbuild", "unable to create temporary file");
/* use a temp file to collect the plain text lines */
- ce->ce_file = getcpy(cp);
+ ce->ce_file = mh_xstrdup(cp);
ce->ce_unlink = 1;
if (buf[0] == '#' && buf[1] == '<') {
continue;
if (!*cp)
adios(EX_DATAERR, NULL, "empty pipe command for #%s directive", ci->ci_type);
- cp = getcpy(cp);
- free(ci->ci_magic);
+ cp = mh_xstrdup(cp);
+ mh_free0(&(ci->ci_magic));
ci->ci_magic = cp;
} else {
/* record filename of decoded contents */
exit(EX_CONFIG);
}
}
- ci->ci_magic = getcpy(cp);
+ ci->ci_magic = mh_xstrdup(cp);
return OK;
}
if (folder)
adios(EX_USAGE, NULL, "only one folder per #forw directive");
else
- folder = getcpy(expandfol(cp));
+ folder = mh_xstrdup(expandfol(cp));
}
}
/* else, use the current folder */
if (!folder)
- folder = getcpy(getcurfol());
+ folder = mh_xstrdup(getcurfol());
if (!(mp = folder_read(folder)))
adios(EX_IOERR, NULL, "unable to read folder %s", folder);
if (!m_convert(mp, cp))
exit(EX_USAGE);
}
- free(folder);
+ mh_free0(&folder);
free_ctinfo(ct);
/*
ct->c_type = CT_MULTIPART;
ct->c_subtype = MULTI_DIGEST;
- m = (struct multipart *) mh_xcalloc(1, sizeof(*m));
+ m = mh_xcalloc(1, sizeof(*m));
ct->c_ctparams = (void *) m;
pp = &m->mp_parts;
CT p;
CE pe;
- p = (CT) mh_xcalloc(1, sizeof(*p));
+ p = mh_xcalloc(1, sizeof(*p));
init_decoded_content(p);
pe = p->c_cefile;
if (get_ctinfo("message/rfc822", p, 0)
snprintf(buffer, sizeof(buffer),
"%s/%d", mp->foldpath,
msgnum);
- pe->ce_file = getcpy(buffer);
+ pe->ce_file = mh_xstrdup(buffer);
- part = (struct part *) mh_xcalloc(1, sizeof(*part));
+ part = mh_xcalloc(1, sizeof(*part));
*pp = part;
pp = &part->mp_next;
part->mp_part = p;
msgnum = mp->lowsel;
snprintf(buffer, sizeof(buffer), "%s/%d",
mp->foldpath, msgnum);
- ce->ce_file = getcpy(buffer);
+ ce->ce_file = mh_xstrdup(buffer);
}
folder_free(mp); /* free folder/message structure */
ct->c_type = CT_MULTIPART;
ct->c_subtype = vrsn;
- m = (struct multipart *) mh_xcalloc(1, sizeof(*m));
+ m = mh_xcalloc(1, sizeof(*m));
ct->c_ctparams = (void *) m;
pp = &m->mp_parts;
if (!p)
continue;
- part = (struct part *) mh_xcalloc(1, sizeof(*part));
+ part = mh_xcalloc(1, sizeof(*part));
*pp = part;
pp = &part->mp_next;
part->mp_part = p;
snprintf(msgid, sizeof(msgid), "<%d.%ld.%%d@%s>\n",
(int) getpid(), (long) clock, LocalName());
partno = 0;
- msgfmt = getcpy(msgid);
+ msgfmt = mh_xstrdup(msgid);
}
snprintf(msgid, sizeof(msgid), msgfmt, top ? 0 : ++partno);
- ct->c_id = getcpy(msgid);
+ ct->c_id = mh_xstrdup(msgid);
}
CT p = part->mp_part;
sprintf(pp, "%d", partnum);
- p->c_partno = getcpy(partnam);
+ p->c_partno = mh_xstrdup(partnam);
if (compose_content(p) == NOTOK)
return NOTOK;
}
if (tfile == NULL) {
adios(EX_CANTCREAT, "mhbuild", "unable to create temporary file");
}
- ce->ce_file = getcpy(tfile);
+ ce->ce_file = mh_xstrdup(tfile);
ce->ce_unlink = 1;
xstdout = 0;
case CT_TEXT:
check8bit = 1;
checkboundary = 1;
- if (ct->c_subtype == TEXT_PLAIN) {
- checklinelen = 0;
- checklinespace = 0;
- } else {
- checklinelen = 1;
- checklinespace = 1;
- }
+ checklinelen = 1;
+ checklinespace = 1;
break;
case CT_MESSAGE:
NULL);
} else {
t->tx_charset = CHARSET_USASCII;
- *ap = getcpy("charset=us-ascii");
+ *ap = mh_xstrdup("charset=us-ascii");
}
cp = strchr(*ap++, '=');
ep = ci->ci_values;
snprintf(buffer, sizeof(buffer), "boundary=%s%d",
prefix, level++);
- cp = strchr(*ap++ = getcpy(buffer), '=');
+ cp = strchr(*ap++ = mh_xstrdup(buffer), '=');
*ap = NULL;
*cp++ = '\0';
*ep = cp;
/*
** output the content type and subtype
*/
- np = getcpy(TYPE_FIELD);
+ np = mh_xstrdup(TYPE_FIELD);
vp = concat(" ", ci->ci_type, "/", ci->ci_subtype, NULL);
/* keep track of length of line */
** output the Content-ID
*/
if (ct->c_id) {
- np = getcpy(ID_FIELD);
+ np = mh_xstrdup(ID_FIELD);
vp = concat(" ", ct->c_id, NULL);
add_header(ct, np, vp);
}
** output the Content-Description
*/
if (ct->c_descr) {
- np = getcpy(DESCR_FIELD);
+ np = mh_xstrdup(DESCR_FIELD);
vp = concat(" ", ct->c_descr, NULL);
if (encode_rfc2047(DESCR_FIELD, &vp, NULL)) {
adios(EX_DATAERR, NULL, "Unable to encode %s header", DESCR_FIELD);
** output the Content-Disposition
*/
if (ct->c_dispo) {
- np = getcpy(DISPO_FIELD);
+ np = mh_xstrdup(DISPO_FIELD);
vp = concat(" ", ct->c_dispo, NULL);
add_header(ct, np, vp);
}
if (ct->c_type == CT_MESSAGE)
adios(EX_DATAERR, NULL, "internal error, invalid encoding");
- np = getcpy(ENCODING_FIELD);
+ np = mh_xstrdup(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(EX_DATAERR, NULL, "internal error, invalid encoding");
- np = getcpy(ENCODING_FIELD);
+ np = mh_xstrdup(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(EX_DATAERR, NULL, "internal error, invalid encoding");
- np = getcpy(ENCODING_FIELD);
+ np = mh_xstrdup(ENCODING_FIELD);
vp = concat(" ", "base64", "\n", NULL);
add_header(ct, np, vp);
break;
if (ct->c_type == CT_MESSAGE)
adios(EX_DATAERR, NULL, "internal error, invalid encoding");
- np = getcpy(ENCODING_FIELD);
+ np = mh_xstrdup(ENCODING_FIELD);
vp = concat(" ", "binary", "\n", NULL);
add_header(ct, np, vp);
break;