From: Paul Fox Date: Sat, 31 Jan 2015 00:41:37 +0000 (-0500) Subject: drop the second argument to part_ok(), since it is always 1 X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/2a00f59c84996b2782505bc49845b8828be500b5?ds=inline drop the second argument to part_ok(), since it is always 1 the second argument hasn't been used since "historical" times. also add some commentary to part_ok(). --- diff --git a/uip/mhcachesbr.c b/uip/mhcachesbr.c index 56ba9b71..201b78e1 100644 --- a/uip/mhcachesbr.c +++ b/uip/mhcachesbr.c @@ -38,7 +38,7 @@ char *cache_private; /* mhmisc.c */ -int part_ok (CT, int); +int part_ok (CT); int type_ok (CT, int); void content_error (char *, CT, char *, ...); void flush_errors (void); diff --git a/uip/mhlist.c b/uip/mhlist.c index 91b09841..3e98b871 100644 --- a/uip/mhlist.c +++ b/uip/mhlist.c @@ -74,7 +74,7 @@ int debugsw = 0; CT parse_mime (char *); /* mhmisc.c */ -int part_ok (CT, int); +int part_ok (CT); int type_ok (CT, int); void flush_errors (void); diff --git a/uip/mhlistsbr.c b/uip/mhlistsbr.c index 309357b1..0110d9e0 100644 --- a/uip/mhlistsbr.c +++ b/uip/mhlistsbr.c @@ -18,7 +18,7 @@ #include /* mhmisc.c */ -int part_ok (CT, int); +int part_ok (CT); int type_ok (CT, int); void flush_errors (void); @@ -343,7 +343,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); } diff --git a/uip/mhmisc.c b/uip/mhmisc.c index f4b89168..abcf8cc7 100644 --- a/uip/mhmisc.c +++ b/uip/mhmisc.c @@ -30,26 +30,36 @@ static char *errs = NULL; /* * prototypes */ -int part_ok (CT, int); +int part_ok (CT); int type_ok (CT, int); void content_error (char *, CT, char *, ...); void flush_errors (void); int -part_ok (CT ct, int sP) +part_ok (CT ct) { char **ap; int len; - if (npart == 0 || (ct->c_type == CT_MULTIPART && (sP || ct->c_subtype))) + /* a part is "ok", i.e., should be processed, if: + - there were no -part arguments + - this part is a multipart + */ + if (npart == 0 || ct->c_type == CT_MULTIPART) { return 1; + } + /* or if: + - this part is a an exact match for any -part option + - this part is a sub-part of any -part option + */ for (ap = parts; *ap; ap++) { len = strlen(*ap); if (!strncmp (*ap, ct->c_partno, len) && - (!ct->c_partno[len] || ct->c_partno[len] == '.' )) + (!ct->c_partno[len] || ct->c_partno[len] == '.' )) { return 1; + } } return 0; diff --git a/uip/mhn.c b/uip/mhn.c index 39d86933..be433d69 100644 --- a/uip/mhn.c +++ b/uip/mhn.c @@ -115,7 +115,7 @@ static int storesw = 0; CT parse_mime (char *); /* mhmisc.c */ -int part_ok (CT, int); +int part_ok (CT); int type_ok (CT, int); void flush_errors (void); diff --git a/uip/mhparse.c b/uip/mhparse.c index a3a80f9a..9f636786 100644 --- a/uip/mhparse.c +++ b/uip/mhparse.c @@ -104,7 +104,7 @@ static struct k2v EncodingType[] = { int find_cache (CT, int, int *, char *, char *, int); /* mhmisc.c */ -int part_ok (CT, int); +int part_ok (CT); int type_ok (CT, int); void content_error (char *, CT, char *, ...); diff --git a/uip/mhshow.c b/uip/mhshow.c index 0227d0c2..63f4fcb0 100644 --- a/uip/mhshow.c +++ b/uip/mhshow.c @@ -86,7 +86,7 @@ int verbosw = 0; CT parse_mime (char *); /* mhmisc.c */ -int part_ok (CT, int); +int part_ok (CT); int type_ok (CT, int); void flush_errors (void); diff --git a/uip/mhshowsbr.c b/uip/mhshowsbr.c index 440fa9e7..4c0e719d 100644 --- a/uip/mhshowsbr.c +++ b/uip/mhshowsbr.c @@ -33,7 +33,7 @@ char *formsw = NULL; /* mhmisc.c */ -int part_ok (CT, int); +int part_ok (CT); int type_ok (CT, int); void content_error (char *, CT, char *, ...); void flush_errors (void); @@ -593,7 +593,7 @@ show_multi_internal (CT ct, int alternate, int concatsw, int textonly, for (part = m->mp_parts; part; part = part->mp_next) { p = part->mp_part; - if (part_ok (p, 1) && type_ok (p, 1)) { + if (part_ok (p) && type_ok (p, 1)) { int inneresult; request_matched = 1; diff --git a/uip/mhstore.c b/uip/mhstore.c index 17dcc01d..65d0b34b 100644 --- a/uip/mhstore.c +++ b/uip/mhstore.c @@ -65,7 +65,7 @@ int debugsw = 0; CT parse_mime (char *); /* mhmisc.c */ -int part_ok (CT, int); +int part_ok (CT); int type_ok (CT, int); void flush_errors (void); diff --git a/uip/mhstoresbr.c b/uip/mhstoresbr.c index ae835fbf..c53f7ad3 100644 --- a/uip/mhstoresbr.c +++ b/uip/mhstoresbr.c @@ -77,7 +77,7 @@ typedef int (*qsort_comp) (const void *, const void *); /* mhmisc.c */ -int part_ok (CT, int); +int part_ok (CT); int type_ok (CT, int); void flush_errors (void); @@ -287,7 +287,7 @@ store_multi (CT ct, mhstoreinfo_t info) 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)) { if (ct->c_storage) { /* Support mhstore -outfile. The MIME parser doesn't load c_storage, so we know that p->c_storage is