]> diplodocus.org Git - nmh/commitdiff
Add support for -changecur and -nochangecur to mhlist(1).
authorKen Hornstein <kenh@pobox.com>
Sat, 9 Nov 2013 15:39:48 +0000 (10:39 -0500)
committerKen Hornstein <kenh@pobox.com>
Sat, 9 Nov 2013 15:39:48 +0000 (10:39 -0500)
docs/pending-release-notes
man/mhlist.man
test/mhlist/test-mhlist
uip/mhlist.c

index b04f610c0b8190da26408ae188f881b5910d45b6..8295c33e82c8689aab130969609adb529457e5c4 100644 (file)
@@ -57,6 +57,7 @@ NEW FEATURES
   connection with the -initialtls switch.
 - Messages can now be selected using a relative offset from some other
   message, or from the start or end of a sequence.  See mh-sequences(5).
+- The -changecur and -nochangecur switches have been added to mhlist(1).
 
 -----------------
 OBSOLETE FEATURES
index bd8f080207822fa0f326431f444f1c9b464a9bf0..46b75636a41c3d88cbf00276158064b05705feda 100644 (file)
@@ -25,6 +25,7 @@ mhlist \- list information about MIME messages
 .RB [ \-wcache
 .IR policy ]
 .RB [ \-check " | " \-nocheck ]
+.RB [ \-changecur " | " \-nochangecur ]
 .RB [ \-verbose " | " \-noverbose ]
 .RB [ \-version ]
 .RB [ \-help ]
@@ -184,8 +185,11 @@ integrity of the content.
 .RB ` \-realsize '
 .RB ` \-rcache\ ask '
 .RB ` \-wcache\ ask '
+.RB ` \-changecur '
 .RB ` \-noverbose '
 .fi
 .SH CONTEXT
 If a folder is given, it will become the current folder.  The last
-message selected will become the current message.
+message selected will become the current message, unless the
+.B \-nochangecur
+option is specified.
index cb793670d512b6fc8ecedcb4a1cfde46782939f9..ad0fb4bb941b5313a251dab8d7510c21574067ce 100755 (executable)
@@ -172,6 +172,13 @@ run_test 'mhlist last -part 2 -noheader -check -nocheck' \
      1     multipart/related          180
      2     text/plain                  36'
 
+#
+# Set the cur sequence to 1 to test default behavior of changecur after
+# this test.
+#
+
+mark 1 -sequence cur -add -zero
+
 # check -verbose
 run_test 'mhlist 11 -verbose -noheader' \
 '  11       multipart/mixed            936
@@ -189,5 +196,18 @@ run_test 'mhlist 11 -verbose -noheader' \
      4     text/plain                  36
             charset="iso-8859-1"'
 
+#
+# Check default changecur behavior
+#
+
+run_test 'mark -sequence cur -list' 'cur: 11'
+
+#
+# Now test -nochangecur
+#
+
+mhlist -nochangecur 1 >/dev/null
+
+run_test 'mark -sequence cur -list' 'cur: 11'
 
 exit $failed
index c63cf888ce90b5eeaa461c442a4c79dc7fa4ed5d..f6208ddb88ffa93dc7052817b102c18b80802fac 100644 (file)
@@ -32,6 +32,8 @@
     X("type content", 0, TYPESW) \
     X("rcache policy", 0, RCACHESW) \
     X("wcache policy", 0, WCACHESW) \
+    X("changecur", 0, CHGSW) \
+    X("nochangecur", 0, NCHGSW) \
     X("version", 0, VERSIONSW) \
     X("help", 0, HELPSW) \
     X("debug", -5, DEBUGSW) \
@@ -96,7 +98,7 @@ static void pipeser (int);
 int
 main (int argc, char **argv)
 {
-    int sizesw = 1, headsw = 1;
+    int sizesw = 1, headsw = 1, chgflag = 1;
     int msgnum, *icachesw;
     char *cp, *file = NULL, *folder = NULL;
     char *maildir, buf[100], **argp;
@@ -203,6 +205,13 @@ do_cache:
                file = *cp == '-' ? cp : path (cp, TFILE);
                continue;
 
+           case CHGSW:
+               chgflag++;
+               continue;
+           case NCHGSW:
+               chgflag = 0;
+               continue;
+
            case VERBSW: 
                verbosw = 1;
                continue;
@@ -341,7 +350,8 @@ do_cache:
     /* If reading from a folder, do some updating */
     if (mp) {
        context_replace (pfolder, folder);/* update current folder  */
-       seq_setcur (mp, mp->hghsel);      /* update current message */
+       if (chgflag)
+           seq_setcur (mp, mp->hghsel);  /* update current message */
        seq_save (mp);                    /* synchronize sequences  */
        context_save ();                  /* save the context file  */
     }