]> diplodocus.org Git - nmh/blobdiff - uip/mhparam.c
Added cpytrim() function. Unlike trimcpy(), it does not modify
[nmh] / uip / mhparam.c
index 19f418e918a12399736c1a6e274b167086df4c13..c4b0af2efbb2091d4c945515f8421b48e01e1807 100644 (file)
@@ -16,23 +16,22 @@ extern char *mhlibdir;
 extern char *mhetcdir;
 
 char *sbackup = BACKUP_PREFIX;
 extern char *mhetcdir;
 
 char *sbackup = BACKUP_PREFIX;
-char *slink = LINK;
-
-static struct swit switches[] = {
-#define        COMPSW    0
-    { "components", 0 },
-#define        NCOMPSW   1
-    { "nocomponents", 0 },
-#define        ALLSW     2
-    { "all", 0 },
-#define VERSIONSW 3
-    { "version", 0 },
-#define        HELPSW    4
-    { "help", 0 },
-#define DEBUGSW   5
-    { "debug", -5 },
-    { NULL, 0 }
-};
+
+#define MHPARAM_SWITCHES \
+    X("components", 0, COMPSW) \
+    X("nocomponents", 0, NCOMPSW) \
+    X("all", 0, ALLSW) \
+    X("version", 0, VERSIONSW) \
+    X("help", 0, HELPSW) \
+    X("debug", 5, DEBUGSW) \
+
+#define X(sw, minchars, id) id,
+DEFINE_SWITCH_ENUM(MHPARAM);
+#undef X
+
+#define X(sw, minchars, id) { sw, minchars, id },
+DEFINE_SWITCH_ARRAY(MHPARAM, switches);
+#undef X
 
 struct proc {
     char *p_name;
 
 struct proc {
     char *p_name;
@@ -43,11 +42,10 @@ static struct proc procs [] = {
      { "context",       &context },
      { "mh-sequences",  &mh_seq },
      { "buildmimeproc", &buildmimeproc },
      { "context",       &context },
      { "mh-sequences",  &mh_seq },
      { "buildmimeproc", &buildmimeproc },
-     { "faceproc",      &faceproc },
      { "fileproc",      &fileproc },
      { "foldprot",      &foldprot },
      { "fileproc",      &fileproc },
      { "foldprot",      &foldprot },
+     { "formatproc",   &formatproc },
      { "incproc",       &incproc },
      { "incproc",       &incproc },
-     { "installproc",   &installproc  },
      { "lproc",         &lproc },
      { "mailproc",      &mailproc },
      { "mhlproc",       &mhlproc },
      { "lproc",         &lproc },
      { "mailproc",      &mailproc },
      { "mhlproc",       &mhlproc },
@@ -56,7 +54,6 @@ static struct proc procs [] = {
      { "mshproc",       &mshproc },
      { "packproc",      &packproc },
      { "postproc",      &postproc },
      { "mshproc",       &mshproc },
      { "packproc",      &packproc },
      { "postproc",      &postproc },
-     { "rmfproc",       &rmfproc },
      { "rmmproc",       &rmmproc },
      { "sendproc",      &sendproc },
      { "showmimeproc",  &showmimeproc },
      { "rmmproc",       &rmmproc },
      { "sendproc",      &sendproc },
      { "showmimeproc",  &showmimeproc },
@@ -68,7 +65,6 @@ static struct proc procs [] = {
      { "etcdir",        &mhetcdir },
      { "libdir",        &mhlibdir },
      { "sbackup",       &sbackup },
      { "etcdir",        &mhetcdir },
      { "libdir",        &mhlibdir },
      { "sbackup",       &sbackup },
-     { "link",          &slink },
      { NULL,            NULL },
 };
 
      { NULL,            NULL },
 };
 
@@ -109,10 +105,10 @@ main(int argc, char **argv)
                    snprintf (buf, sizeof(buf), "%s [profile-components] [switches]",
                        invo_name);
                    print_help (buf, switches, 1);
                    snprintf (buf, sizeof(buf), "%s [profile-components] [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 COMPSW:
                    components = 1;
 
                case COMPSW:
                    components = 1;
@@ -148,7 +144,7 @@ main(int argc, char **argv)
        for (np = m_defs; np; np = np->n_next)
            printf("%s: %s\n", np->n_name, np->n_field);
 
        for (np = m_defs; np; np = np->n_next)
            printf("%s: %s\n", np->n_name, np->n_field);
 
-    } if (debug) {
+    } else if (debug) {
        struct proc *ps;
 
        /*
        struct proc *ps;
 
        /*