From 8d8f1c3abc586c005c904e52c4adbfe694d2201c Mon Sep 17 00:00:00 2001 From: markus schnalke Date: Tue, 1 May 2012 11:19:24 +0200 Subject: [PATCH] mhlist, mhbuild: Always evaluate realsizes of the MIME parts. This already had been the default. Now I removed the -[no]realsize switches. --- man/mhbuild.man1 | 14 +++++--------- man/mhlist.man1 | 12 ++---------- uip/mhbuild.c | 35 ++++++++++++----------------------- uip/mhlist.c | 33 +++++++++++---------------------- uip/mhlistsbr.c | 46 ++++++++++++++++++++++------------------------ uip/mhshowsbr.c | 8 ++++---- 6 files changed, 56 insertions(+), 92 deletions(-) diff --git a/man/mhbuild.man1 b/man/mhbuild.man1 index 4fa75b5..2c4bcce 100644 --- a/man/mhbuild.man1 +++ b/man/mhbuild.man1 @@ -10,7 +10,6 @@ mhbuild \- translate MIME composition draft .B mhbuild .I file .RB [ \-list " | " \-nolist ] -.RB [ \-realsize " | " \-norealsize ] .RB [ \-headers " | " \-noheaders ] .RB [ \-ebcdicsafe " | " \-noebcdicsafe ] .RB [ \-rfc934mode " | " \-norfc934mode ] @@ -64,13 +63,11 @@ to list the table of contents associated with the MIME message that is created. The .B \-headers switch indicates -that a one-line banner should be displayed above the listing. The -.B \-realsize -switch tells -.B mhbuild -to evaluate the \*(lqnative\*(rq -(decoded) format of each content prior to listing. This provides an -accurate count at the expense of a small delay. If the +that a one-line banner should be displayed above the listing. +The size of the \*(lqnative\*(rq +(decoded) format of each content is evaluated. This provides an +accurate count at the expense of a small delay. +If the .B \-verbose switch is present, then the listing will show any \*(lqextra\*(rq information @@ -555,7 +552,6 @@ mhlist(1), show(1), mhstore(1), .SH DEFAULTS .nf .RB ` \-headers ' -.RB ` \-realsize ' .RB ` \-norfc934mode ' .RB ` \-contentid ' .RB ` \-noebcdicsafe ' diff --git a/man/mhlist.man1 b/man/mhlist.man1 index 395d838..1936959 100644 --- a/man/mhlist.man1 +++ b/man/mhlist.man1 @@ -19,7 +19,6 @@ mhlist \- list information about MIME messages .IR content ] \&... .RB [ \-headers " | " \-noheaders ] -.RB [ \-realsize " | " \-norealsize ] .RB [ \-verbose " | " \-noverbose ] .RB [ \-version ] .RB [ \-help ] @@ -40,15 +39,9 @@ The .B \-headers switch indicates that a one-line banner should be displayed above the listing. -.PP -The -.B \-realsize -switch tells -.B mhlist -to evaluate the -\*(lqnative\*(rq (decoded) format of each content prior to listing. +The size of the +\*(lqnative\*(rq (decoded) format of each content is evaluated. This provides an accurate count at the expense of a small delay. -.PP If the .B \-verbose switch is present, then the listing will show @@ -154,7 +147,6 @@ mhbuild(1), show(1), mhstore(1), sendfiles(1) .RB ` +folder "' defaults to the current folder" .RB ` msgs "' defaults to cur" .RB ` \-headers ' -.RB ` \-realsize ' .RB ` \-noverbose ' .fi diff --git a/uip/mhbuild.c b/uip/mhbuild.c index d22e455..cc319f5 100644 --- a/uip/mhbuild.c +++ b/uip/mhbuild.c @@ -41,27 +41,23 @@ static struct swit switches[] = { { "list", 0 }, #define NLISTSW 5 { "nolist", 0 }, -#define SIZESW 6 - { "realsize", 0 }, -#define NSIZESW 7 - { "norealsize", 0 }, -#define RFC934SW 8 +#define RFC934SW 6 { "rfc934mode", 0 }, -#define NRFC934SW 9 +#define NRFC934SW 7 { "norfc934mode", 0 }, -#define VERBSW 10 +#define VERBSW 8 { "verbose", 0 }, -#define NVERBSW 11 +#define NVERBSW 9 { "noverbose", 0 }, -#define CONTENTIDSW 12 +#define CONTENTIDSW 10 { "contentid", 0 }, -#define NCONTENTIDSW 13 +#define NCONTENTIDSW 11 { "nocontentid", 0 }, -#define VERSIONSW 14 +#define VERSIONSW 12 { "version", 0 }, -#define HELPSW 15 +#define HELPSW 13 { "help", 0 }, -#define DEBUGSW 16 +#define DEBUGSW 14 { "debug", -5 }, { NULL, 0 } }; @@ -128,7 +124,7 @@ int output_message(CT, char *); int output_message_fp(CT, FILE *, char*); /* mhlistsbr.c */ -int list_all_messages(CT *, int, int, int, int); +int list_all_messages(CT *, int, int, int); /* mhmisc.c */ void set_endian(void); @@ -140,7 +136,7 @@ void free_content(CT); int main(int argc, char **argv) { - int sizesw = 1, headsw = 1; + int headsw = 1; char *cp, buf[BUFSIZ]; char buffer[BUFSIZ], *compfile = NULL; char **argp, **arguments; @@ -215,13 +211,6 @@ main(int argc, char **argv) rfc934sw = 0; continue; - case SIZESW: - sizesw++; - continue; - case NSIZESW: - sizesw = 0; - continue; - case CONTENTIDSW: contentidsw = 1; continue; @@ -352,7 +341,7 @@ main(int argc, char **argv) ** List the message info */ if (listsw) - list_all_messages(cts, headsw, sizesw, verbosw, debugsw); + list_all_messages(cts, headsw, verbosw, debugsw); /* Rename composition draft */ snprintf(buffer, sizeof(buffer), "%s.orig", m_backup(compfile)); diff --git a/uip/mhlist.c b/uip/mhlist.c index 99b2cc7..685c8ff 100644 --- a/uip/mhlist.c +++ b/uip/mhlist.c @@ -21,25 +21,21 @@ static struct swit switches[] = { { "headers", 0 }, #define NHEADSW 1 { "noheaders", 0 }, -#define SIZESW 2 - { "realsize", 0 }, -#define NSIZESW 3 - { "norealsize", 0 }, -#define VERBSW 4 +#define VERBSW 2 { "verbose", 0 }, -#define NVERBSW 5 +#define NVERBSW 3 { "noverbose", 0 }, -#define FILESW 6 /* interface from show */ +#define FILESW 4 /* interface from show */ { "file file", 0 }, -#define PARTSW 7 +#define PARTSW 5 { "part number", 0 }, -#define TYPESW 8 +#define TYPESW 6 { "type content", 0 }, -#define VERSIONSW 9 +#define VERSIONSW 7 { "version", 0 }, -#define HELPSW 10 +#define HELPSW 8 { "help", 0 }, -#define DEBUGSW 11 +#define DEBUGSW 9 { "debug", -5 }, { NULL, 0 } }; @@ -76,7 +72,7 @@ void set_endian(void); void flush_errors(void); /* mhlistsbr.c */ -void list_all_messages(CT *, int, int, int, int); +void list_all_messages(CT *, int, int, int); /* mhfree.c */ void free_content(CT); @@ -92,7 +88,7 @@ static void pipeser(int); int main(int argc, char **argv) { - int sizesw = 1, headsw = 1; + int headsw = 1; int msgnum; char *cp, *file = NULL, *folder = NULL; char *maildir, buf[100], **argp; @@ -141,13 +137,6 @@ main(int argc, char **argv) headsw = 0; continue; - case SIZESW: - sizesw = 1; - continue; - case NSIZESW: - sizesw = 0; - continue; - case PARTSW: if (!(cp = *argp++) || *cp == '-') adios(NULL, "missing argument to %s", @@ -290,7 +279,7 @@ main(int argc, char **argv) /* ** List the message content */ - list_all_messages(cts, headsw, sizesw, verbosw, debugsw); + list_all_messages(cts, headsw, verbosw, debugsw); /* Now free all the structures for the content */ for (ctp = cts; *ctp; ctp++) diff --git a/uip/mhlistsbr.c b/uip/mhlistsbr.c index 5dee115..c2db987 100644 --- a/uip/mhlistsbr.c +++ b/uip/mhlistsbr.c @@ -25,17 +25,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); +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_multi(CT, int, int, int); +static int list_partial(CT, int, int, int); static int list_encoding(CT); @@ -57,7 +57,7 @@ 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 headers, int verbose, int debug) { CT ct, *ctp; @@ -67,7 +67,7 @@ list_all_messages(CT *cts, int headers, int realsize, int verbose, int debug) for (ctp = cts; *ctp; ctp++) { ct = *ctp; - list_single_message(ct, realsize, verbose, debug); + list_single_message(ct, verbose, debug); } flush_errors(); @@ -78,11 +78,11 @@ 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; @@ -97,20 +97,18 @@ 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: if (ct->c_subtype == MESSAGE_PARTIAL) { - return list_partial(ct, toplevel, realsize, verbose, - debug); + return list_partial(ct, toplevel, verbose, debug); } else { - return list_content(ct, toplevel, realsize, verbose, - debug); + return list_content(ct, toplevel, verbose, debug); } break; @@ -119,7 +117,7 @@ list_switch(CT ct, int toplevel, int realsize, int verbose, int debug) case CT_IMAGE: case CT_VIDEO: case CT_APPLICATION: - return list_content(ct, toplevel, realsize, verbose, debug); + return list_content(ct, toplevel, verbose, debug); break; default: @@ -138,7 +136,7 @@ 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]; @@ -150,7 +148,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; @@ -293,20 +291,20 @@ 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; @@ -317,11 +315,11 @@ 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); diff --git a/uip/mhshowsbr.c b/uip/mhshowsbr.c index 9b7e7b0..b5ecd09 100644 --- a/uip/mhshowsbr.c +++ b/uip/mhshowsbr.c @@ -34,8 +34,8 @@ void content_error(char *, CT, char *, ...); void flush_errors(void); /* mhlistsbr.c */ -int list_switch(CT, int, int, int, int); -int list_content(CT, int, int, int, int); +int list_switch(CT, int, int, int); +int list_content(CT, int, int, int); /* ** prototypes @@ -458,9 +458,9 @@ show_content_aux2(CT ct, int alternate, char *cracked, if (xlist) { if (ct->c_type == CT_MULTIPART) - list_content(ct, -1, 1, 0, 0); + list_content(ct, -1, 0, 0); else - list_switch(ct, -1, 1, 0, 0); + list_switch(ct, -1, 0, 0); } fflush(stdout); -- 1.7.10.4