Removed unnecessary #include of h/signals.h.
[mmh] / uip / mhlistsbr.c
index 4c788d1..08f35c7 100644 (file)
@@ -9,9 +9,7 @@
 
 #include <h/mh.h>
 #include <fcntl.h>
-#include <h/signals.h>
 #include <errno.h>
-#include <signal.h>
 #include <h/tws.h>
 #include <h/mime.h>
 #include <h/mhparse.h>
@@ -25,19 +23,17 @@ void flush_errors(void);
 /*
 ** prototypes
 */
-void list_all_messages(CT *, int, int, int, int);
-int list_switch(CT, int, int, int, int);
-int list_content(CT, int, int, int, int);
+void list_all_messages(CT *, int, int);
+int list_switch(CT, int, int, int);
+int list_content(CT, int, int, int);
 
 /*
 ** static prototypes
 */
-static void list_single_message(CT, int, int, int);
+static void list_single_message(CT, 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_multi(CT, int, int, int);
+static int list_partial(CT, int, int, int);
 static int list_encoding(CT);
 
 
@@ -58,21 +54,16 @@ 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)
+list_all_messages(CT *cts, int verbose, int debug)
 {
        CT ct, *ctp;
 
-       if (headers)
-               printf(LSTFMT1, "msg", "part", "type/subtype", "size",
-                               "description");
-
+       printf(LSTFMT1, "msg", "part", "type/subtype", "size", "description");
        for (ctp = cts; *ctp; ctp++) {
                ct = *ctp;
-               list_single_message(ct, realsize, verbose, debug);
+               list_single_message(ct, verbose, debug);
        }
-
        flush_errors();
 }
 
@@ -80,13 +71,12 @@ 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)
+list_single_message(CT ct, int verbose, int debug)
 {
        if (type_ok(ct, 1)) {
                umask(ct->c_umask);
-               list_switch(ct, 1, realsize, verbose, debug);
+               list_switch(ct, 1, verbose, debug);
                if (ct->c_fp) {
                        fclose(ct->c_fp);
                        ct->c_fp = NULL;
@@ -100,32 +90,19 @@ 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)
+list_switch(CT ct, int toplevel, int verbose, int debug)
 {
        switch (ct->c_type) {
        case CT_MULTIPART:
-               return list_multi(ct, toplevel, realsize, verbose, debug);
+               return list_multi(ct, toplevel, 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;
+               if (ct->c_subtype == MESSAGE_PARTIAL) {
+                       return list_partial(ct, toplevel, verbose, debug);
+               } else {
+                       return list_content(ct, toplevel, verbose, debug);
                }
                break;
 
@@ -133,12 +110,8 @@ list_switch(CT ct, int toplevel, int realsize, int verbose, int debug)
        case CT_AUDIO:
        case CT_IMAGE:
        case CT_VIDEO:
-               return list_content(ct, toplevel, realsize, verbose, debug);
-               break;
-
        case CT_APPLICATION:
-               return list_application(ct, toplevel, realsize, verbose,
-                               debug);
+               return list_content(ct, toplevel, verbose, debug);
                break;
 
        default:
@@ -156,9 +129,8 @@ 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)
+list_content(CT ct, int toplevel, int verbose, int debug)
 {
        unsigned long size;
        char *cp, buffer[BUFSIZ];
@@ -170,7 +142,7 @@ list_content(CT ct, int toplevel, int realsize, int verbose, int debug)
                        empty(ci->ci_subtype));
        printf(LSTFMT2b, empty(ct->c_partno), buffer);
 
-       if (ct->c_cesizefnx && realsize)
+       if (ct->c_cesizefnx)
                size = (*ct->c_cesizefnx) (ct);
        else
                size = ct->c_end - ct->c_begin;
@@ -209,18 +181,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 = getcpy(ci->ci_comment));
-               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)
@@ -233,7 +214,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)
 {
@@ -267,8 +247,8 @@ list_debug(CT ct)
                         ct->c_type, ct->c_subtype,
                         (unsigned int)(unsigned long) ct->c_ctparams);
 
+       fprintf(stderr, "    charset  \"%s\"\n", empty(ct->c_charset));
        fprintf(stderr, "    showproc  \"%s\"\n", empty(ct->c_showproc));
-       fprintf(stderr, "    termproc  \"%s\"\n", empty(ct->c_termproc));
        fprintf(stderr, "    storeproc \"%s\"\n", empty(ct->c_storeproc));
 
        /* print transfer encoding information */
@@ -304,22 +284,21 @@ list_debug(CT ct)
 /*
 ** list content information for type "multipart"
 */
-
 static int
-list_multi(CT ct, int toplevel, int realsize, int verbose, int debug)
+list_multi(CT ct, int toplevel, int verbose, int debug)
 {
        struct multipart *m = (struct multipart *) ct->c_ctparams;
        struct part *part;
 
        /* list the content for toplevel of this multipart */
-       list_content(ct, toplevel, realsize, verbose, debug);
+       list_content(ct, toplevel, verbose, debug);
 
        /* now list for all the subparts */
        for (part = m->mp_parts; part; part = part->mp_next) {
                CT p = part->mp_part;
 
                if (part_ok(p, 1) && type_ok(p, 1))
-                       list_switch(p, 0, realsize, verbose, debug);
+                       list_switch(p, 0, verbose, debug);
        }
 
        return OK;
@@ -329,13 +308,12 @@ 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)
+list_partial(CT ct, int toplevel, int verbose, int debug)
 {
        struct partial *p = (struct partial *) ct->c_ctparams;
 
-       list_content(ct, toplevel, realsize, verbose, debug);
+       list_content(ct, toplevel, verbose, debug);
        if (verbose) {
                printf("\t     [message %s, part %d",
                                p->pm_partid, p->pm_partno);
@@ -349,79 +327,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)
 {