nmh-workers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Nmh-workers] -part option and sub-parts


From: Oliver Kiddle
Subject: [Nmh-workers] -part option and sub-parts
Date: Thu, 16 Dec 2004 17:29:35 +0100

The following patch is a fix to the second bug I described in my message
to the list on 1st September (see
http://www.mhonarc.org/archive/html/nmh-workers/2004-09/msg00002.html).
Because I regard this as a bug fix, I'll commit it to CVS unless anyone
complains first.

The problem was that when specifying an option such as -part 1, it
excludes a 1.1 part. With this fix, "mhshow -part 1" where part 1 is
multipart/alternative, will allow a 1.1 or 1.2 part to be displayed.
The fix also affects mhlist and mhstore. It won't help for multiply
nested multipart messages where nmh numbers them 1.11 instead of 1.1.1.
See http://savannah.nongnu.org/bugs/?func=detailitem&item_id=9742
I thought it'd be better if that bug (9742) is fixed instead.

Oliver

Index: uip/mhmisc.c
===================================================================
RCS file: /cvsroot/nmh/nmh/uip/mhmisc.c,v
retrieving revision 1.4
diff -u -r1.4 mhmisc.c
--- uip/mhmisc.c        30 Sep 2003 16:58:43 -0000      1.4
+++ uip/mhmisc.c        16 Dec 2004 16:07:22 -0000
@@ -45,13 +45,17 @@
 part_ok (CT ct, int sP)
 {
     char **ap;
+    int len;
 
     if (npart == 0 || (ct->c_type == CT_MULTIPART && (sP || ct->c_subtype)))
        return 1;
 
-    for (ap = parts; *ap; ap++)
-       if (!strcmp (*ap, ct->c_partno))
-           return 1;
+    for (ap = parts; *ap; ap++) {
+        len = strlen(*ap);
+        if (!strncmp (*ap, ct->c_partno, len) &&
+                (!ct->c_partno[len] || ct->c_partno[len] == '.' ))
+            return 1;
+    }
 
     return 0;
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]