]> diplodocus.org Git - nmh/blobdiff - uip/mhlist.c
Beginning of work to run mhbuild always. A bit more complicated than I
[nmh] / uip / mhlist.c
index 1363081c39b0edc6cdd0df389953467906ab1cd4..f6208ddb88ffa93dc7052817b102c18b80802fac 100644 (file)
@@ -11,8 +11,6 @@
 #include <fcntl.h>
 #include <h/signals.h>
 #include <h/md5.h>
 #include <fcntl.h>
 #include <h/signals.h>
 #include <h/md5.h>
-#include <errno.h>
-#include <signal.h>
 #include <h/mts.h>
 #include <h/tws.h>
 #include <h/mime.h>
 #include <h/mts.h>
 #include <h/tws.h>
 #include <h/mime.h>
@@ -34,6 +32,8 @@
     X("type content", 0, TYPESW) \
     X("rcache policy", 0, RCACHESW) \
     X("wcache policy", 0, WCACHESW) \
     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) \
     X("version", 0, VERSIONSW) \
     X("help", 0, HELPSW) \
     X("debug", -5, DEBUGSW) \
@@ -86,7 +86,6 @@ void flush_errors (void);
 void list_all_messages (CT *, int, int, int, int);
 
 /* mhfree.c */
 void list_all_messages (CT *, int, int, int, int);
 
 /* mhfree.c */
-void free_content (CT);
 extern CT *cts;
 void freects_done (int) NORETURN;
 
 extern CT *cts;
 void freects_done (int) NORETURN;
 
@@ -99,7 +98,7 @@ static void pipeser (int);
 int
 main (int argc, char **argv)
 {
 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;
     int msgnum, *icachesw;
     char *cp, *file = NULL, *folder = NULL;
     char *maildir, buf[100], **argp;
@@ -206,6 +205,13 @@ do_cache:
                file = *cp == '-' ? cp : path (cp, TFILE);
                continue;
 
                file = *cp == '-' ? cp : path (cp, TFILE);
                continue;
 
+           case CHGSW:
+               chgflag++;
+               continue;
+           case NCHGSW:
+               chgflag = 0;
+               continue;
+
            case VERBSW: 
                verbosw = 1;
                continue;
            case VERBSW: 
                verbosw = 1;
                continue;
@@ -279,7 +285,7 @@ do_cache:
            adios (maildir, "unable to change directory to");
 
        /* read folder and create message structure */
            adios (maildir, "unable to change directory to");
 
        /* read folder and create message structure */
-       if (!(mp = folder_read (folder)))
+       if (!(mp = folder_read (folder, 0)))
            adios (NULL, "unable to read folder %s", folder);
 
        /* check for empty folder */
            adios (NULL, "unable to read folder %s", folder);
 
        /* check for empty folder */
@@ -344,7 +350,8 @@ do_cache:
     /* If reading from a folder, do some updating */
     if (mp) {
        context_replace (pfolder, folder);/* update current folder  */
     /* 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  */
     }
        seq_save (mp);                    /* synchronize sequences  */
        context_save ();                  /* save the context file  */
     }
@@ -358,7 +365,6 @@ static void
 pipeser (int i)
 {
     if (i == SIGQUIT) {
 pipeser (int i)
 {
     if (i == SIGQUIT) {
-       unlink ("core");
        fflush (stdout);
        fprintf (stderr, "\n");
        fflush (stderr);
        fflush (stdout);
        fprintf (stderr, "\n");
        fflush (stderr);