mhshow/mhstore: Removed support for retrieving message/external-body parts.
[mmh] / uip / mhlistsbr.c
index 7830173..1777cf4 100644 (file)
@@ -12,7 +12,6 @@
 #include <h/signals.h>
 #include <errno.h>
 #include <signal.h>
-#include <h/mts.h>
 #include <h/tws.h>
 #include <h/mime.h>
 #include <h/mhparse.h>
@@ -37,8 +36,6 @@ static void list_single_message(CT, int, int, int);
 static int list_debug(CT);
 static int list_multi(CT, int, int, int, int);
 static int list_partial(CT, int, int, int, int);
-static int list_external(CT, int, int, int, int);
-static int list_application(CT, int, int, int, int);
 static int list_encoding(CT);
 
 
@@ -59,7 +56,6 @@ static int list_encoding(CT);
 /*
 ** Top level entry point to list group of messages
 */
-
 void
 list_all_messages(CT *cts, int headers, int realsize, int verbose, int debug)
 {
@@ -81,7 +77,6 @@ list_all_messages(CT *cts, int headers, int realsize, int verbose, int debug)
 /*
 ** Entry point to list a single message
 */
-
 static void
 list_single_message(CT ct, int realsize, int verbose, int debug)
 {
@@ -101,56 +96,36 @@ list_single_message(CT ct, int realsize, int verbose, int debug)
 /*
 ** Primary switching routine to list information about a content
 */
-
 int
 list_switch(CT ct, int toplevel, int realsize, int verbose, int debug)
 {
        switch (ct->c_type) {
-               case CT_MULTIPART:
-                       return list_multi(ct, toplevel, realsize, verbose,
-                                       debug);
-                       break;
-
-               case CT_MESSAGE:
-                       switch (ct->c_subtype) {
-                               case MESSAGE_PARTIAL:
-                                       return list_partial(ct, toplevel,
-                                                       realsize, verbose,
-                                                       debug);
-                                       break;
-
-                               case MESSAGE_EXTERNAL:
-                                       return list_external(ct, toplevel,
-                                                       realsize, verbose,
-                                                       debug);
-                                       break;
-
-                               case MESSAGE_RFC822:
-                               default:
-                                       return list_content(ct, toplevel,
-                                                       realsize, verbose,
-                                                       debug);
-                                       break;
-                       }
-                       break;
-
-               case CT_TEXT:
-               case CT_AUDIO:
-               case CT_IMAGE:
-               case CT_VIDEO:
+       case CT_MULTIPART:
+               return list_multi(ct, toplevel, realsize, verbose, debug);
+               break;
+
+       case CT_MESSAGE:
+               if (ct->c_subtype == MESSAGE_PARTIAL) {
+                       return list_partial(ct, toplevel, realsize, verbose,
+                                               debug);
+               } else {
                        return list_content(ct, toplevel, realsize, verbose,
-                                       debug);
-                       break;
-
-               case CT_APPLICATION:
-                       return list_application(ct, toplevel, realsize,
-                                       verbose, debug);
-                       break;
-
-               default:
-                       /* list_debug (ct); */
-                       adios(NULL, "unknown content type %d", ct->c_type);
-                       break;
+                                               debug);
+               }
+               break;
+
+       case CT_TEXT:
+       case CT_AUDIO:
+       case CT_IMAGE:
+       case CT_VIDEO:
+       case CT_APPLICATION:
+               return list_content(ct, toplevel, realsize, verbose, debug);
+               break;
+
+       default:
+               /* list_debug (ct); */
+               adios(NULL, "unknown content type %d", ct->c_type);
+               break;
        }
 
        return 0;  /* NOT REACHED */
@@ -162,7 +137,6 @@ list_switch(CT ct, int toplevel, int realsize, int verbose, int debug)
 /*
 ** Method for listing information about a simple/generic content
 */
-
 int
 list_content(CT ct, int toplevel, int realsize, int verbose, int debug)
 {
@@ -188,26 +162,26 @@ list_content(CT ct, int toplevel, int realsize, int verbose, int debug)
 
        /* print size of this body part */
        switch (*cp) {
-               case ' ':
-                       if (size > 0 || ct->c_encoding != CE_EXTERNAL)
-                               printf(LSTFMT2c1, size);
-                       else
-                               printf(LSTFMT2c4);
-                       break;
-
-               default:
-                       printf(LSTFMT2c2, size, *cp);
-                       break;
-
-               case '\0':
-                       printf(LSTFMT2c3);
+       case ' ':
+               if (size > 0 || ct->c_encoding != CE_EXTERNAL)
+                       printf(LSTFMT2c1, size);
+               else
+                       printf(LSTFMT2c4);
+               break;
+
+       default:
+               printf(LSTFMT2c2, size, *cp);
+               break;
+
+       case '\0':
+               printf(LSTFMT2c3);
        }
 
        /* print Content-Description */
        if (ct->c_descr) {
                char *dp;
 
-               dp = trimcpy(cp = add(ct->c_descr, NULL));
+               dp = trimcpy(cp = getcpy(ct->c_descr));
                free(cp);
                printf(LSTFMT2d1, dp);
                free(dp);
@@ -215,18 +189,27 @@ list_content(CT ct, int toplevel, int realsize, int verbose, int debug)
 
        printf("\n");
 
-       /*
-       ** If verbose, print any RFC-822 comments in the
-       ** Content-Type line.
-       */
-       if (verbose && ci->ci_comment) {
-               char *dp;
+       if (verbose) {
+               char **ap, **ep;
+               CI ci = &ct->c_ctinfo;
 
-               dp = trimcpy(cp = add(ci->ci_comment, NULL));
-               free(cp);
-               snprintf(buffer, sizeof(buffer), "(%s)", dp);
-               free(dp);
-               printf(LSTFMT2d2, buffer);
+               for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++) {
+                       printf("\t\t%s=\"%s\"\n", *ap, *ep);
+               }
+
+               /*
+               ** If verbose, print any RFC-822 comments in the
+               ** Content-Type line.
+               */
+               if (ci->ci_comment) {
+                       char *dp;
+
+                       dp = trimcpy(cp = add(ci->ci_comment, NULL));
+                       free (cp);
+                       snprintf(buffer, sizeof(buffer), "(%s)", dp);
+                       free(dp);
+                       printf(LSTFMT2d2, buffer);
+               }
        }
 
        if (debug)
@@ -239,7 +222,6 @@ list_content(CT ct, int toplevel, int realsize, int verbose, int debug)
 /*
 ** Print debugging information about a content
 */
-
 static int
 list_debug(CT ct)
 {
@@ -310,7 +292,6 @@ list_debug(CT ct)
 /*
 ** list content information for type "multipart"
 */
-
 static int
 list_multi(CT ct, int toplevel, int realsize, int verbose, int debug)
 {
@@ -335,7 +316,6 @@ list_multi(CT ct, int toplevel, int realsize, int verbose, int debug)
 /*
 ** list content information for type "message/partial"
 */
-
 static int
 list_partial(CT ct, int toplevel, int realsize, int verbose, int debug)
 {
@@ -355,79 +335,9 @@ list_partial(CT ct, int toplevel, int realsize, int verbose, int debug)
 
 
 /*
-** list content information for type "message/external"
-*/
-
-static int
-list_external(CT ct, int toplevel, int realsize, int verbose, int debug)
-{
-       struct exbody *e = (struct exbody *) ct->c_ctparams;
-
-       /*
-        * First list the information for the
-        * message/external content itself.
-        */
-       list_content(ct, toplevel, realsize, verbose, debug);
-
-       if (verbose) {
-               if (e->eb_name)
-                       printf("\t     name=\"%s\"\n", e->eb_name);
-               if (e->eb_dir)
-                       printf("\t     directory=\"%s\"\n", e->eb_dir);
-               if (e->eb_site)
-                       printf("\t     site=\"%s\"\n", e->eb_site);
-               if (e->eb_server)
-                       printf("\t     server=\"%s\"\n", e->eb_server);
-               if (e->eb_subject)
-                       printf("\t     subject=\"%s\"\n", e->eb_subject);
-
-               /* This must be defined */
-               printf("\t     access-type=\"%s\"\n", e->eb_access);
-
-               if (e->eb_mode)
-                       printf("\t     mode=\"%s\"\n", e->eb_mode);
-               if (e->eb_permission)
-                       printf("\t     permission=\"%s\"\n", e->eb_permission);
-
-               if (e->eb_flags == NOTOK)
-                       printf("\t     [service unavailable]\n");
-       }
-
-       /*
-       ** Now list the information for the external content
-       ** to which this content points.
-       */
-       list_content(e->eb_content, 0, realsize, verbose, debug);
-
-       return OK;
-}
-
-
-/*
-** list content information for type "application"
-*/
-
-static int
-list_application(CT ct, int toplevel, int realsize, int verbose, int debug)
-{
-       list_content(ct, toplevel, realsize, verbose, debug);
-       if (verbose) {
-               char **ap, **ep;
-               CI ci = &ct->c_ctinfo;
-
-               for (ap = ci->ci_attrs, ep = ci->ci_values; *ap; ap++, ep++)
-                       printf("\t     %s=\"%s\"\n", *ap, *ep);
-       }
-
-       return OK;
-}
-
-
-/*
 ** list information about the Content-Transfer-Encoding
 ** used by a content.
 */
-
 static int
 list_encoding(CT ct)
 {