]> diplodocus.org Git - nmh/blobdiff - uip/sortm.c
Fix the format engine so it properly keeps track of multibyte characters
[nmh] / uip / sortm.c
index 024fcf5c4c20643633a52cd8395b56fd9ffc6d14..429f75f9708c7884978a161500079ea920fd6b34 100644 (file)
 #include <h/tws.h>
 #include <h/utils.h>
 
-static struct swit switches[] = {
-#define DATESW                 0
-     { "datefield field", 0 },
-#define        TEXTSW                 1
-     { "textfield field", 0 },
-#define        NSUBJSW                2
-     { "notextfield", 0 },
-#define SUBJSW                 3
-     { "subject", -3 },                   /* backward-compatibility */
-#define LIMSW                  4
-     { "limit days", 0 },
-#define        NLIMSW                 5
-     { "nolimit", 0 },
-#define VERBSW                 6
-     { "verbose", 0 },
-#define NVERBSW                7
-     { "noverbose", 0 },
-#define ALLMSGS                8
-     { "all", 0 },
-#define NALLMSGS               9
-     { "noall", 0 },
-#define CHECKSW               10
-     { "check", 0 },
-#define NCHECKSW              11
-     { "nocheck", 0 },
-#define VERSIONSW             12
-     { "version", 0 },
-#define HELPSW                13
-     { "help", 0 },
-     { NULL, 0 }
-};
+#define SORTM_SWITCHES \
+    X("datefield field", 0, DATESW) \
+    X("textfield field", 0, TEXTSW) \
+    X("notextfield", 0, NSUBJSW) \
+    X("subject", -3, SUBJSW) /* backward-compatibility */ \
+    X("limit days", 0, LIMSW) \
+    X("nolimit", 0, NLIMSW) \
+    X("verbose", 0, VERBSW) \
+    X("noverbose", 0, NVERBSW) \
+    X("all", 0, ALLMSGS) \
+    X("noall", 0, NALLMSGS) \
+    X("check", 0, CHECKSW) \
+    X("nocheck", 0, NCHECKSW) \
+    X("version", 0, VERSIONSW) \
+    X("help", 0, HELPSW) \
+
+#define X(sw, minchars, id) id,
+DEFINE_SWITCH_ENUM(SORTM);
+#undef X
+
+#define X(sw, minchars, id) { sw, minchars, id },
+DEFINE_SWITCH_ARRAY(SORTM, switches);
+#undef X
 
 struct smsg {
     int s_msg;