X-Git-Url: http://git.marmaro.de/?p=mmh;a=blobdiff_plain;f=uip%2Fmhparse.c;h=0813aa75c6ebff464ce58327cac59b7496020534;hp=1839a15ddd544b78a204e254fee8ff2e3668f80e;hb=7879ea4084333b448c5a3a49c1cb52023e3808d1;hpb=1691e80890e5d8ba258c51c214a3e91880e1db2b diff --git a/uip/mhparse.c b/uip/mhparse.c index 1839a15..0813aa7 100644 --- a/uip/mhparse.c +++ b/uip/mhparse.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include @@ -205,8 +205,7 @@ pidcheck (int status) fflush (stdout); fflush (stderr); - done (1); - /* NOTREACHED */ + return done (1); } @@ -1194,9 +1193,9 @@ InitMessage (CT ct) struct k2v *kv; CI ci = &ct->c_ctinfo; - if (ct->c_encoding != CE_7BIT) { + if ((ct->c_encoding != CE_7BIT) && (ct->c_encoding != CE_8BIT)) { admonish (NULL, - "\"%s/%s\" type in message %s should be encoded in 7bit", + "\"%s/%s\" type in message %s should be encoded in 7bit or 8bit", ci->ci_type, ci->ci_subtype, ct->c_file); return NOTOK; } @@ -1569,6 +1568,8 @@ openBase64 (CT ct, char **file) unsigned long bits; unsigned char value, *b, *b1, *b2, *b3; char *cp, *ep, buffer[BUFSIZ]; + /* sbeck -- handle prefixes */ + CI ci; CE ce; MD5_CTX mdContext; @@ -1599,6 +1600,19 @@ openBase64 (CT ct, char **file) ce->ce_unlink = 0; } + /* sbeck@cise.ufl.edu -- handle suffixes */ + ci = &ct->c_ctinfo; + snprintf (buffer, sizeof(buffer), "%s-suffix-%s/%s", + invo_name, ci->ci_type, ci->ci_subtype); + cp = context_find (buffer); + if (cp == NULL || *cp == '\0') { + snprintf (buffer, sizeof(buffer), "%s-suffix-%s", invo_name, + ci->ci_type); + cp = context_find (buffer); + } + if (cp != NULL && *cp != '\0') + ce->ce_file = add (cp, ce->ce_file); + if ((ce->ce_fp = fopen (ce->ce_file, "w+")) == NULL) { content_error (ce->ce_file, ct, "unable to fopen for reading/writing"); return NOTOK; @@ -1768,6 +1782,8 @@ openQuoted (CT ct, char **file) char buffer[BUFSIZ]; unsigned char mask; CE ce; + /* sbeck -- handle prefixes */ + CI ci; MD5_CTX mdContext; ce = ct->c_cefile; @@ -1792,6 +1808,24 @@ openQuoted (CT ct, char **file) ce->ce_unlink = 0; } + /* sbeck@cise.ufl.edu -- handle suffixes */ + ci = &ct->c_ctinfo; + snprintf (buffer, sizeof(buffer), "%s-suffix-%s/%s", + invo_name, ci->ci_type, ci->ci_subtype); + cp = context_find (buffer); + if (cp == NULL || *cp == '\0') { + snprintf (buffer, sizeof(buffer), "%s-suffix-%s", invo_name, + ci->ci_type); + cp = context_find (buffer); + } + if (cp != NULL && *cp != '\0') + ce->ce_file = add (cp, ce->ce_file); + + if ((ce->ce_fp = fopen (ce->ce_file, "w+")) == NULL) { + content_error (ce->ce_file, ct, "unable to fopen for reading/writing"); + return NOTOK; + } + if ((ce->ce_fp = fopen (ce->ce_file, "w+")) == NULL) { content_error (ce->ce_file, ct, "unable to fopen for reading/writing"); return NOTOK; @@ -1966,6 +2000,9 @@ open7Bit (CT ct, char **file) { int cc, fd, len; char buffer[BUFSIZ]; + /* sbeck -- handle prefixes */ + char *cp; + CI ci; CE ce; ce = ct->c_cefile; @@ -1990,6 +2027,19 @@ open7Bit (CT ct, char **file) ce->ce_unlink = 0; } + /* sbeck@cise.ufl.edu -- handle suffixes */ + ci = &ct->c_ctinfo; + snprintf (buffer, sizeof(buffer), "%s-suffix-%s/%s", + invo_name, ci->ci_type, ci->ci_subtype); + cp = context_find (buffer); + if (cp == NULL || *cp == '\0') { + snprintf (buffer, sizeof(buffer), "%s-suffix-%s", invo_name, + ci->ci_type); + cp = context_find (buffer); + } + if (cp != NULL && *cp != '\0') + ce->ce_file = add (cp, ce->ce_file); + if ((ce->ce_fp = fopen (ce->ce_file, "w+")) == NULL) { content_error (ce->ce_file, ct, "unable to fopen for reading/writing"); return NOTOK; @@ -2400,7 +2450,7 @@ losing_ftp: goto losing_ftp; #endif - if (cachefile[0]) + if (cachefile[0]) { if (caching) chmod (cachefile, cachetype ? m_gmprot () : 0444); else { @@ -2414,7 +2464,7 @@ losing_ftp: fseek (gp, 0L, SEEK_SET); - while ((cc = fread (buffer, sizeof(*buffer), sizeof(buffer), gp)) + while ((cc= fread (buffer, sizeof(*buffer), sizeof(buffer), gp)) > 0) fwrite (buffer, sizeof(*buffer), cc, fp); fflush (fp); @@ -2432,6 +2482,7 @@ losing_ftp: } umask (mask); } + } fseek (ce->ce_fp, 0L, SEEK_SET); *file = ce->ce_file;