]> diplodocus.org Git - nmh/blobdiff - uip/install-mh.c
The start of the use of argsplit() to process command strings.
[nmh] / uip / install-mh.c
index 2cf9081c7a78b03675df212a2219abecb21dc538..2921d2619ccc0bd74f2f9e285ae4e08da05c8ce9 100644 (file)
 #include <h/utils.h>
 #include <pwd.h>                               /* structure for getpwuid() results */
 
-static struct swit switches[] = {
-#define AUTOSW     0
-    { "auto", 0 },
-#define VERSIONSW  1
-    { "version", 0 },
-#define HELPSW     2
-    { "help", 0 },
-#define CHECKSW     3
-    { "check", 1 },
-    { NULL, 0 }
-};
+#define INSTALLMH_SWITCHES \
+    X("auto", 0, AUTOSW) \
+    X("version", 0, VERSIONSW) \
+    X("help", 0, HELPSW) \
+    X("check", 1, CHECKSW) \
+
+#define X(sw, minchars, id) id,
+DEFINE_SWITCH_ENUM(INSTALLMH);
+#undef X
+
+#define X(sw, minchars, id) { sw, minchars, id },
+DEFINE_SWITCH_ARRAY(INSTALLMH, switches);
+#undef X
 
 /*
  * static prototypes