+/* Determine if the part with type[/subtype] should be decoded, according to
+ decodetypes (which came from the -decodetypes switch). */
+static int
+should_decode(const char *decodetypes, const char *type, const char *subtype) {
+ /* Quick search for matching type[/subtype] in decodetypes: bracket
+ decodetypes with commas, then search for ,type, and ,type/subtype, in
+ it. */
+
+ int found_match = 0;
+ char *delimited_decodetypes = concat(",", decodetypes, ",", NULL);
+ char *delimited_type = concat(",", type, ",", NULL);
+
+ if (nmh_strcasestr(delimited_decodetypes, delimited_type)) {
+ found_match = 1;
+ } else if (subtype != NULL) {
+ char *delimited_type_subtype =
+ concat(",", type, "/", subtype, ",", NULL);
+
+ if (nmh_strcasestr(delimited_decodetypes, delimited_type_subtype)) {
+ found_match = 1;
+ }
+ free(delimited_type_subtype);