]> diplodocus.org Git - nmh/blobdiff - uip/mhlist.c
Added scan and inc from mbox with multiple messages.
[nmh] / uip / mhlist.c
index 6ef455d1a8567127582939336de85eeb31ff32bf..1363081c39b0edc6cdd0df389953467906ab1cd4 100644 (file)
 #include <h/mhcachesbr.h>
 #include <h/utils.h>
 
 #include <h/mhcachesbr.h>
 #include <h/utils.h>
 
-static struct swit switches[] = {
-#define        CHECKSW                 0
-    { "check", 0 },
-#define        NCHECKSW                1
-    { "nocheck", 0 },
-#define        HEADSW                  2
-    { "headers", 0 },
-#define        NHEADSW                 3
-    { "noheaders", 0 },
-#define        SIZESW                  4
-    { "realsize", 0 },
-#define        NSIZESW                 5
-    { "norealsize", 0 },
-#define        VERBSW                  6
-    { "verbose", 0 },
-#define        NVERBSW                 7
-    { "noverbose", 0 },
-#define        FILESW                  8       /* interface from show */
-    { "file file", 0 },
-#define        PARTSW                  9
-    { "part number", 0 },
-#define        TYPESW                 10
-    { "type content", 0 },
-#define        RCACHESW               11
-    { "rcache policy", 0 },
-#define        WCACHESW               12
-    { "wcache policy", 0 },
-#define VERSIONSW              13
-    { "version", 0 },
-#define        HELPSW                 14
-    { "help", 0 },
-
-/*
- * switches for debugging
- */
-#define        DEBUGSW                15
-    { "debug", -5 },
-    { NULL, 0 }
-};
+#define MHLIST_SWITCHES \
+    X("check", 0, CHECKSW) \
+    X("nocheck", 0, NCHECKSW) \
+    X("headers", 0, HEADSW) \
+    X("noheaders", 0, NHEADSW) \
+    X("realsize", 0, SIZESW) \
+    X("norealsize", 0, NSIZESW) \
+    X("verbose", 0, VERBSW) \
+    X("noverbose", 0, NVERBSW) \
+    X("file file", 0, FILESW) \
+    X("part number", 0, PARTSW) \
+    X("type content", 0, TYPESW) \
+    X("rcache policy", 0, RCACHESW) \
+    X("wcache policy", 0, WCACHESW) \
+    X("version", 0, VERSIONSW) \
+    X("help", 0, HELPSW) \
+    X("debug", -5, DEBUGSW) \
+
+#define X(sw, minchars, id) id,
+DEFINE_SWITCH_ENUM(MHLIST);
+#undef X
+
+#define X(sw, minchars, id) { sw, minchars, id },
+DEFINE_SWITCH_ARRAY(MHLIST, switches);
+#undef X
 
 
 /* mhparse.c */
 
 
 /* mhparse.c */
@@ -94,7 +80,6 @@ CT parse_mime (char *);
 /* mhmisc.c */
 int part_ok (CT, int);
 int type_ok (CT, int);
 /* mhmisc.c */
 int part_ok (CT, int);
 int type_ok (CT, int);
-void set_endian (void);
 void flush_errors (void);
 
 /* mhlistsbr.c */
 void flush_errors (void);
 
 /* mhlistsbr.c */
@@ -108,7 +93,7 @@ void freects_done (int) NORETURN;
 /*
  * static prototypes
  */
 /*
  * static prototypes
  */
-static RETSIGTYPE pipeser (int);
+static void pipeser (int);
 
 
 int
 
 
 int
@@ -152,10 +137,10 @@ main (int argc, char **argv)
                snprintf (buf, sizeof(buf), "%s [+folder] [msgs] [switches]",
                        invo_name);
                print_help (buf, switches, 1);
                snprintf (buf, sizeof(buf), "%s [+folder] [msgs] [switches]",
                        invo_name);
                print_help (buf, switches, 1);
-               done (1);
+               done (0);
            case VERSIONSW:
                print_version(invo_name);
            case VERSIONSW:
                print_version(invo_name);
-               done (1);
+               done (0);
 
            case RCACHESW:
                icachesw = &rcachesw;
 
            case RCACHESW:
                icachesw = &rcachesw;
@@ -245,8 +230,6 @@ do_cache:
     parts[npart] = NULL;
     types[ntype] = NULL;
 
     parts[npart] = NULL;
     types[ntype] = NULL;
 
-    set_endian ();
-
     /* Check for public cache location */
     if ((cache_public = context_find (nmhcache)) && *cache_public != '/')
        cache_public = NULL;
     /* Check for public cache location */
     if ((cache_public = context_find (nmhcache)) && *cache_public != '/')
        cache_public = NULL;
@@ -280,7 +263,7 @@ do_cache:
            adios (NULL, "out of memory");
        ctp = cts;
 
            adios (NULL, "out of memory");
        ctp = cts;
 
-       if ((ct = parse_mime (file)));
+       if ((ct = parse_mime (file)))
            *ctp++ = ct;
     } else {
        /*
            *ctp++ = ct;
     } else {
        /*
@@ -371,7 +354,7 @@ do_cache:
 }
 
 
 }
 
 
-static RETSIGTYPE
+static void
 pipeser (int i)
 {
     if (i == SIGQUIT) {
 pipeser (int i)
 {
     if (i == SIGQUIT) {