]> diplodocus.org Git - nmh/blobdiff - uip/mhparam.c
Convert whatnow over to using the new Attach header.
[nmh] / uip / mhparam.c
index 1da25d312a7e505ef57bad4974f03d56d15abd88..b0c119cfa4365a676536d62e9ffc93fbe32c8672 100644 (file)
@@ -5,32 +5,75 @@
  * Originally contributed by
  * Jeffrey C Honig <Jeffrey_C_Honig@cornell.edu>
  *
- * $Id$
+ * This code is Copyright (c) 2002, by the authors of nmh.  See the
+ * COPYRIGHT file in the root directory of the nmh distribution for
+ * complete copyright information.
  */
 
 #include <h/mh.h>
 
+#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
+
 extern char *mhlibdir;
 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", 4 },
-#define DEBUGSW   5
-    { "debug", -5 },
-    { NULL, 0 }
-};
+
+char *lockmethod =
+#if defined FCNTL_LOCKING
+    "fcntl"
+#elif defined FLOCK_LOCKING
+    "flock"
+#elif defined LOCKF_LOCKING
+    "lockf"
+#elif defined DOT_LOCKING
+    "dot"
+#else
+    "none"
+#endif
+    ;
+
+char *sasl =
+#ifdef CYRUS_SASL
+    "cyrus_sasl";
+#else
+    "";
+#endif
+
+char *tls =
+#ifdef TLS_SUPPORT
+    "tls";
+#else
+    "";
+#endif
+
+char *mimetypeproc =
+#ifdef MIMETYPEPROC
+    MIMETYPEPROC;
+#else
+    "";
+#endif
+
+char *mimeencodingproc =
+#ifdef MIMEENCODINGPROC
+    MIMEENCODINGPROC;
+#else
+    "";
+#endif
 
 struct proc {
     char *p_name;
@@ -38,36 +81,38 @@ struct proc {
 };
 
 static struct proc procs [] = {
-     { "context",       &context },
-     { "mh-sequences",  &mh_seq },
-     { "buildmimeproc", &buildmimeproc },
-     { "faceproc",      &faceproc },
-     { "fileproc",      &fileproc },
-     { "foldprot",      &foldprot },
-     { "incproc",       &incproc },
-     { "installproc",   &installproc  },
-     { "lproc",         &lproc },
-     { "mailproc",      &mailproc },
-     { "mhlproc",       &mhlproc },
-     { "moreproc",      &moreproc },
-     { "msgprot",       &msgprot },
-     { "mshproc",       &mshproc },
-     { "packproc",      &packproc },
-     { "postproc",      &postproc },
-     { "rmfproc",       &rmfproc },
-     { "rmmproc",       &rmmproc },
-     { "sendproc",      &sendproc },
-     { "showmimeproc",  &showmimeproc },
-     { "showproc",      &showproc },
-     { "version",       &version_num },
-     { "vmhproc",       &vmhproc },
-     { "whatnowproc",   &whatnowproc },
-     { "whomproc",      &whomproc },
-     { "etcdir",        &mhetcdir },
-     { "libdir",        &mhlibdir },
-     { "sbackup",       &sbackup },
-     { "link",          &slink },
-     { NULL,            NULL },
+     { "context",          &context },
+     { "mh-sequences",     &mh_seq },
+     { "buildmimeproc",    &buildmimeproc },
+     { "fileproc",         &fileproc },
+     { "foldprot",         &foldprot },
+     { "formatproc",      &formatproc },
+     { "incproc",          &incproc },
+     { "lproc",            &lproc },
+     { "mailproc",         &mailproc },
+     { "mhlproc",          &mhlproc },
+     { "mimetypeproc",     &mimetypeproc },
+     { "mimeencodingproc", &mimeencodingproc },
+     { "moreproc",         &moreproc },
+     { "msgprot",          &msgprot },
+     { "mshproc",          &mshproc },
+     { "packproc",         &packproc },
+     { "postproc",         &postproc },
+     { "rmmproc",          &rmmproc },
+     { "sendproc",         &sendproc },
+     { "showmimeproc",     &showmimeproc },
+     { "showproc",         &showproc },
+     { "version",          &version_num },
+     { "vmhproc",          &vmhproc },
+     { "whatnowproc",      &whatnowproc },
+     { "whomproc",         &whomproc },
+     { "etcdir",           &mhetcdir },
+     { "libdir",           &mhlibdir },
+     { "sbackup",          &sbackup },
+     { "lockmethod",       &lockmethod },
+     { "sasl",             &sasl },
+     { "tls",              &tls },
+     { NULL,               NULL },
 };
 
 
@@ -107,10 +152,10 @@ main(int argc, char **argv)
                    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);
-                   done (1);
+                   done (0);
 
                case COMPSW:
                    components = 1;
@@ -146,7 +191,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);
 
-    } if (debug) {
+    } else if (debug) {
        struct proc *ps;
 
        /*
@@ -178,6 +223,7 @@ main(int argc, char **argv)
     }
     
     done (missed);
+    return 1;
 }
 
 
@@ -187,7 +233,7 @@ p_find(char *str)
     struct proc *ps;
 
     for (ps = procs; ps->p_name; ps++)
-       if (!strcasecmp (ps->p_name, str))
+       if (!strcasecmp (ps->p_name, str ? str : ""))
            return (*ps->p_field);
 
     return NULL;