]> diplodocus.org Git - nmh/blobdiff - uip/mhlistsbr.c
Make many m_getfld() buffer parameters NMH_BUFSIZ big.
[nmh] / uip / mhlistsbr.c
index ee2800a834ac65d92f47998ce4e70fb05fdb7ed7..452c7fd4022ff09b95ed719423786b6357a61634 100644 (file)
@@ -1,6 +1,4 @@
-
-/*
- * mhlistsbr.c -- routines to list information about the
+/* mhlistsbr.c -- routines to list information about the
  *             -- contents of MIME messages
  *
  * This code is Copyright (c) 2002, by the authors of nmh.  See the
@@ -10,7 +8,6 @@
 
 #include <h/mh.h>
 #include <fcntl.h>
-#include <h/signals.h>
 #include <h/mts.h>
 #include <h/tws.h>
 #include <h/mime.h>
@@ -18,7 +15,7 @@
 #include <h/utils.h>
 
 /* mhmisc.c */
-int part_ok (CT, int);
+int part_ok (CT);
 int type_ok (CT, int);
 void flush_errors (void);
 
@@ -40,12 +37,14 @@ static int list_encoding (CT);
 #define        LSTFMT1         "%4s %-5s %-24s %5s %s\n"
 #define        LSTFMT2a        "%4d "
 #define        LSTFMT2b        "%-5s %-24.24s "
+#define        LSTFMT2bv       "%-5s %-24s "
 #define        LSTFMT2c1       "%5lu"
 #define        LSTFMT2c2       "%4lu%c"
 #define        LSTFMT2c3       "huge "
 #define        LSTFMT2c4       "     "
 #define        LSTFMT2d1       " %.36s"
-#define        LSTFMT2d2       "\t     %-65.65s\n"
+#define        LSTFMT2d1v      " %s"
+#define        LSTFMT2d2       "\t     %-65s\n"
 
 
 /*
@@ -156,7 +155,10 @@ list_content (CT ct, int toplevel, int realsize, int verbose, int debug,
 
     snprintf (buffer, sizeof(buffer), "%s/%s", empty (ci->ci_type),
                empty (ci->ci_subtype));
-    printf (LSTFMT2b, empty (ct->c_partno), buffer);
+    if (verbose)
+       printf (LSTFMT2bv, empty (ct->c_partno), buffer);
+    else
+       printf (LSTFMT2b, empty (ct->c_partno), buffer);
 
     if (ct->c_cesizefnx && realsize)
        size = (*ct->c_cesizefnx) (ct);
@@ -164,7 +166,7 @@ list_content (CT ct, int toplevel, int realsize, int verbose, int debug,
        size = ct->c_end - ct->c_begin;
 
     /* find correct scale for size (Kilo/Mega/Giga/Tera) */
-    for (cp = " KMGT"; size > 9999; size >>= 10)
+    for (cp = " KMGT"; size > 9999; size /= 1000)
        if (!*++cp)
            break;
 
@@ -190,11 +192,14 @@ list_content (CT ct, int toplevel, int realsize, int verbose, int debug,
        char *dp;
 
        dp = cpytrim (ct->c_descr);
-       printf (LSTFMT2d1, dp);
+       if (verbose)
+           printf (LSTFMT2d1v, dp);
+       else
+           printf (LSTFMT2d1, dp);
        free (dp);
     }
 
-    printf ("\n");
+    putchar('\n');
 
     if (verbose) {
        CI ci = &ct->c_ctinfo;
@@ -335,7 +340,7 @@ list_multi (CT ct, int toplevel, int realsize, int verbose, int debug,
     for (part = m->mp_parts; part; part = part->mp_next) {
        CT p = part->mp_part;
 
-       if (part_ok (p, 1) && type_ok (p, 1))
+       if (part_ok (p) && type_ok (p, 1))
            list_switch (p, 0, realsize, verbose, debug, dispo);
     }
 
@@ -358,7 +363,7 @@ list_partial (CT ct, int toplevel, int realsize, int verbose, int debug,
        printf ("\t     [message %s, part %d", p->pm_partid, p->pm_partno);
        if (p->pm_maxno)
            printf (" of %d", p->pm_maxno);
-       printf ("]\n");
+       puts("]");
     }
 
     return OK;
@@ -404,7 +409,7 @@ list_external (CT ct, int toplevel, int realsize, int verbose, int debug,
            printf ("\t     permission=\"%s\"\n", e->eb_permission);
 
        if (e->eb_flags == NOTOK)
-           printf ("\t     [service unavailable]\n");
+           puts("\t     [service unavailable]");
 
     }