I've finished this.  With the patch below, you can add a line like:

    mhshow-suffix-application/msword: .doc
    mhshow-suffix-application/PostScript: .ps

to the mhn.defaults file to append the given suffix to a scratch
file.  This allows applications which require a certain suffix to
run properly.

This fixes Base64, Quoted-printable, and 7Bit encodings (only very
rudimentary testing with the last one...).

Let me know if there's anything missing...

*** uip/mhparse.c.orig  Fri Mar  3 18:15:09 2000
--- uip/mhparse.c       Mon Mar  6 14:23:16 2000
***************
*** 1568,1573 ****
--- 1568,1575 ----
      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;
  
***************
*** 1598,1603 ****
--- 1600,1618 ----
        ce->ce_unlink = 0;
      }
  
+     /* [EMAIL PROTECTED] -- 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;
***************
*** 1767,1772 ****
--- 1782,1789 ----
      char buffer[BUFSIZ];
      unsigned char mask;
      CE ce;
+     /* sbeck -- handle prefixes */
+     CI ci;
      MD5_CTX mdContext;
  
      ce = ct->c_cefile;
***************
*** 1791,1796 ****
--- 1808,1831 ----
        ce->ce_unlink = 0;
      }
  
+     /* [EMAIL PROTECTED] -- 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;
***************
*** 1965,1970 ****
--- 2000,2008 ----
  {
      int       cc, fd, len;
      char buffer[BUFSIZ];
+     /* sbeck -- handle prefixes */
+     char *cp;
+     CI ci;
      CE ce;
  
      ce = ct->c_cefile;
***************
*** 1988,1993 ****
--- 2026,2044 ----
        ce->ce_file = add (*file, NULL);
        ce->ce_unlink = 0;
      }
+ 
+     /* [EMAIL PROTECTED] -- 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");


--------------------------|  Sullivan Beck  |---------------------------
mailto:[EMAIL PROTECTED]          |            Senior System Programmer
http://www.cise.ufl.edu/~sbeck     |               University of Florida
PH : (352) 392-1057                |                     CISE Department
Fax: (352) 392-1220                |                            CSE 314E
------------------------------------------------------------------------

Reply via email to