]> diplodocus.org Git - nmh/blobdiff - h/mh.h
Beginning of implementation of new argsplit() function to handle arguments
[nmh] / h / mh.h
diff --git a/h/mh.h b/h/mh.h
index 97c7769b66faa19488db631f72f32376a13416b4..2cd546b11a03a8bafe5277ae1938171bdf2f6215 100644 (file)
--- a/h/mh.h
+++ b/h/mh.h
@@ -1,8 +1,6 @@
 
 /*
  * mh.h -- main header file for all of nmh
- *
- * $Id$
  */
 
 #include <h/nmh.h>
@@ -34,8 +32,10 @@ typedef unsigned char  boolean;  /* not int so we can pack in a structure */
  */
 #if __GNUC__ > 2
 #define NORETURN __attribute__((__noreturn__))
+#define NMH_UNUSED(i) (void) i
 #else
 #define NORETURN
+#define NMH_UNUSED(i) i
 #endif
 
 /*
@@ -55,6 +55,11 @@ struct node {
 #define        UNKWNSW  (-1)   /* from smatch() on unknown switch   */
 
 struct swit {
+
+    /*
+     * Switch name
+     */
+
     char *sw;
 
     /* The minchars field is apparently used like this:
@@ -63,8 +68,54 @@ struct swit {
        0  : Switch can't be abbreviated;               switch shown in -help.
        #  : Switch can be abbreviated to # characters; switch shown in -help. */
     int minchars;
+
+    /*
+     * If we pick this switch, return this value from smatch
+     */
+
+    int swret;
 };
 
+/*
+ * Macros to use when declaring struct swit arrays.
+ *
+ * These macros are what known as X-Macros.  In your source code you
+ * use them like this:
+ *
+ * #define FOO_SWITCHES \
+ *    X("switch1", 0, SWITCHSW) \
+ *    X("switch2", 0, SWITCH2SW) \
+ *    X("thirdswitch", 2, SWITCH3SW) \
+ *
+ * The argument to each entry in FOO_SWITCHES are the switch name (sw),
+ * the minchars field (see above) and the return value for this switch.
+ *
+ * After you define FOO_SWITCHES, you instantiate it as follows:
+ *
+ * #define X(sw, minchars, id) id,
+ * DEFINE_SWITCH_ENUM(FOO);
+ * #undef X
+ *
+ * #define X(sw, minchars, id) { sw, minchars, id },
+ * DEFINE_SWITCH_ARRAY(FOO);
+ * #undef X
+ *
+ * DEFINE_SWITCH_ENUM defines an extra enum at the end of the list called
+ * LEN_FOO.
+ */
+
+#define DEFINE_SWITCH_ENUM(name) \
+    enum { \
+       name ## _SWITCHES \
+       LEN_ ## name \
+    }
+
+#define DEFINE_SWITCH_ARRAY(name, array) \
+    static struct swit array[] = { \
+       name ## _SWITCHES \
+       { NULL, 0, 0 } \
+    }
+
 extern struct swit anoyes[];   /* standard yes/no switches */
 
 #define ATTACHFORMATS 3                /* Number of send attach formats. */
@@ -223,7 +274,15 @@ struct msgs {
  * m_getfld() message parsing
  */
 
-#define NAMESZ  128            /* Limit on component name size     */
+#define NAMESZ  999            /* Limit on component name size.
+                                  RFC 2822 limits line lengths to
+                                  998 characters, so a header name
+                                  can be at most that long.
+                                  m_getfld limits header names to 2
+                                  less than NAMESZ, which is fine,
+                                  because header names must be
+                                  followed by a colon.  Add one for
+                                  terminating NULL. */
 
 #define LENERR  (-2)           /* Name too long error from getfld  */
 #define FMTERR  (-3)           /* Message Format error             */
@@ -255,6 +314,11 @@ extern char *msg_delim;            /*  .. */
 
 #define OUTPUTLINELEN  72      /* default line length for headers */
 
+#define LINK   "@"             /* Name of link to file to which you are */
+                               /* replying. */
+
+#define NMH_ATTACH_HEADER "Nmh-Attachment"  /* Default header for -attach */
+
 /*
  * miscellaneous macros
  */
@@ -285,6 +349,13 @@ extern char *defpath;              /* pathname of user's profile      */
 extern char *ctxpath;          /* pathname of user's context      */
 extern struct node *m_defs;    /* list of profile/context entries */
 
+/* What style to use for generated Message-ID and Content-ID header
+   fields.  The localname style is pid.time@localname, where time is
+   in seconds.  The random style replaces the localname with some
+   (pseudo)random bytes and uses microsecond-resolution time. */
+int save_message_id_style (const char *);
+char *message_id (time_t, int);
+
 /*
  * These standard strings are defined in config.c.  They are the
  * only system-dependent parameters in nmh, and thus by redefining
@@ -296,14 +367,13 @@ extern char *catproc;
 extern char *components;
 extern char *context;
 extern char *current;
-extern char *defaulteditor;
 extern char *defaultfolder;
 extern char *digestcomps;
 extern char *distcomps;
 extern char *draft;
-extern char *faceproc;
 extern char *fileproc;
 extern char *foldprot;
+extern char *formatproc;
 extern char *forwcomps;
 extern char *inbox;
 extern char *incproc;
@@ -333,7 +403,6 @@ extern char *rcvdistcomps;
 extern char *rcvstoreproc;
 extern char *replcomps;
 extern char *replgroupcomps;
-extern char *rmfproc;
 extern char *rmmproc;
 extern char *sendproc;
 extern char *showmimeproc;