]> diplodocus.org Git - nmh/blobdiff - uip/mark.c
lock_file.c: close(2) file descriptor on failure, avoiding leak.
[nmh] / uip / mark.c
index 439ea40703ab080888eeb48e408d25fd126860cd..0b17b862a0d0f11770d19b35201c4242d28590db 100644 (file)
@@ -1,6 +1,4 @@
-
-/*
- * mark.c -- add message(s) to sequences in given folder
+/* mark.c -- add message(s) to sequences in given folder
  *        -- delete messages (s) from sequences in given folder
  *        -- list sequences in given folder
  *
@@ -11,6 +9,7 @@
 
 #include <h/mh.h>
 #include <h/utils.h>
+#include "sbr/m_maildir.h"
 
 #define MARK_SWITCHES \
     X("add", 0, ADDSW) \
@@ -52,11 +51,7 @@ main (int argc, char **argv)
     struct msgs_array msgs = { 0, 0, NULL };
     struct msgs *mp;
 
-    setlocale(LC_ALL, "");
-    invo_name = r1bindex (argv[0], '/');
-
-    /* read user profile/context */
-    context_read();
+    if (nmh_init(argv[0], 1)) { return 1; }
 
     arguments = getarguments (invo_name, argc, argv, 1);
     argp = arguments;
@@ -125,10 +120,9 @@ main (int argc, char **argv)
        if (*cp == '+' || *cp == '@') {
            if (folder)
                adios (NULL, "only one folder at a time!");
-           else
-               folder = pluspath (cp);
+            folder = pluspath (cp);
        } else
-               app_msgarg(&msgs, cp);
+            app_msgarg(&msgs, cp);
     }
 
     /*
@@ -250,7 +244,7 @@ print_debug (struct msgs *mp)
 /*
  * Print debugging info about all the SELECTED
  * messages and the sequences they are in.
- * Due limitattions of snprintb(), only a limited
+ * Due to limitations of snprintb(), only a limited
  * number of sequences will be printed.  See the
  * comments in sbr/seq_bits.c.
  */
@@ -260,12 +254,12 @@ seq_printdebug (struct msgs *mp)
     int msgnum;
     char buf[BUFSIZ];
 
-    printf ("\n");
+    putchar('\n');
     for (msgnum = mp->lowsel; msgnum <= mp->hghsel; msgnum++) {
        if (is_selected (mp, msgnum))
            printf ("%*d: %s\n", DMAXFOLDER, msgnum,
                    snprintb (buf, sizeof buf,
-                             (unsigned) *bvector_bits (msgstat (mp, msgnum)),
+                             (unsigned) bvector_first_bits (msgstat (mp, msgnum)),
                              seq_bits (mp)));
     }
 }