X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fmhbuildsbr.c;h=069ea85f2f87dc44d815f8ec5b695530edd1f8c4;hp=94c1ce731efd5eafbcceb63b914cf078b4f7c469;hb=0b40f7c1c35770622511eda71ec5353784ea1dc6;hpb=097c84b61603c4a4c5837f3dcc09c30a1e751702 diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c index 94c1ce7..069ea85 100644 --- a/uip/mhbuildsbr.c +++ b/uip/mhbuildsbr.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include @@ -171,8 +170,8 @@ build_mime(char *infile) } /* 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) { @@ -214,7 +213,7 @@ finish_field: ** 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); @@ -227,7 +226,7 @@ finish_field: 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"); @@ -424,7 +423,7 @@ user_content(FILE *in, char *file, char *buf, CT *ctp) 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] == '<') { @@ -652,7 +651,7 @@ use_forw: 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 { @@ -682,7 +681,7 @@ use_forw: done(1); } } - ci->ci_magic = add(cp, NULL); + ci->ci_magic = getcpy(cp); return OK; } @@ -703,7 +702,7 @@ use_forw: ap = brkstring(ci->ci_magic, " ", "\n"); copyip(ap, arguments, MAXARGS); } else { - arguments[0] = "cur"; + arguments[0] = seq_cur; arguments[1] = NULL; } folder = NULL; @@ -715,13 +714,13 @@ use_forw: 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); @@ -773,7 +772,7 @@ use_forw: 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; @@ -795,7 +794,7 @@ use_forw: 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; } @@ -966,7 +965,7 @@ compose_content(CT ct) 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; } @@ -1032,7 +1031,7 @@ compose_content(CT ct) 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; @@ -1120,7 +1119,7 @@ raw: 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: @@ -1335,7 +1334,7 @@ scan_content(CT ct) 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 */ @@ -1369,7 +1368,7 @@ scan_content(CT ct) NULL); } else { t->tx_charset = CHARSET_USASCII; - *ap = add("charset=us-ascii", NULL); + *ap = getcpy("charset=us-ascii"); } cp = strchr(*ap++, '='); @@ -1438,7 +1437,7 @@ build_headers(CT ct) 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; @@ -1457,7 +1456,7 @@ build_headers(CT ct) /* ** 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 */ @@ -1514,7 +1513,7 @@ build_headers(CT ct) ** 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); } @@ -1523,7 +1522,7 @@ build_headers(CT ct) ** 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); } @@ -1532,7 +1531,7 @@ build_headers(CT ct) ** 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); } @@ -1550,7 +1549,7 @@ skip_headers: ** 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); @@ -1562,18 +1561,13 @@ skip_headers: switch (ct->c_encoding) { case CE_7BIT: /* Nothing to output */ -#if 0 - np = add(ENCODING_FIELD, NULL); - vp = concat(" ", "7bit", "\n", NULL); - add_header(ct, np, vp); -#endif break; case CE_8BIT: 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; @@ -1582,7 +1576,7 @@ skip_headers: 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; @@ -1591,7 +1585,7 @@ skip_headers: 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; @@ -1600,7 +1594,7 @@ skip_headers: 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;