#define UNKWNSW (-1) /* from smatch() on unknown switch */
struct swit {
+
+ /*
+ * Switch name
+ */
+
char *sw;
/* The minchars field is apparently used like this:
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. */
/*
* type for holding the sequence set of a message
*/
-typedef unsigned int seqset_t;
-
-/*
- * Determine the number of user defined sequences we
- * can have. The first 5 sequence flags are for
- * internal nmh message flags.
- */
-#define NUMATTRS ((sizeof(seqset_t) * Nbby) - 5)
+typedef unsigned long seqset_t;
/*
* first free slot for user defined sequences
*/
#define FFATTRSLOT 5
+/*
+ * Determine the number of user defined sequences we
+ * can have. The first FFATTRSLOT sequence flags are for
+ * internal nmh message flags.
+ */
+#define NUMATTRS ((sizeof(seqset_t) * Nbby) - FFATTRSLOT)
+
/*
* internal messages attributes (sequences)
*/
* in a particular sequence.
*/
seqset_t *msgstats; /* msg status */
+
+ /*
+ * A FILE handle containing an open filehandle for the sequence file
+ * for this folder. If non-NULL, use it when the sequence file is
+ * written.
+ */
+ FILE *seqhandle;
+
+ /*
+ * The name of the public sequence file; required by lkfclose()
+ */
+ char *seqname;
};
/*
#define set_deleted(mp,msgnum) ((mp)->msgstats[(msgnum) - mp->lowoff] |= DELETED)
#define in_sequence(mp,seqnum,msgnum) \
- ((mp)->msgstats[(msgnum) - mp->lowoff] & (1 << (FFATTRSLOT + seqnum)))
+ ((mp)->msgstats[(msgnum) - mp->lowoff] & ((seqset_t)1 << (FFATTRSLOT + seqnum)))
#define clear_sequence(mp,seqnum,msgnum) \
- ((mp)->msgstats[(msgnum) - mp->lowoff] &= ~(1 << (FFATTRSLOT + seqnum)))
+ ((mp)->msgstats[(msgnum) - mp->lowoff] &= ~((seqset_t)1 << (FFATTRSLOT + seqnum)))
#define add_sequence(mp,seqnum,msgnum) \
- ((mp)->msgstats[(msgnum) - mp->lowoff] |= (1 << (FFATTRSLOT + seqnum)))
+ ((mp)->msgstats[(msgnum) - mp->lowoff] |= ((seqset_t)1 << (FFATTRSLOT + seqnum)))
#define is_seq_private(mp,seqnum) \
- ((mp)->attrstats & (1 << (FFATTRSLOT + seqnum)))
+ ((mp)->attrstats & ((seqset_t)1 << (FFATTRSLOT + seqnum)))
#define make_seq_public(mp,seqnum) \
- ((mp)->attrstats &= ~(1 << (FFATTRSLOT + seqnum)))
+ ((mp)->attrstats &= ~((seqset_t)1 << (FFATTRSLOT + seqnum)))
#define make_seq_private(mp,seqnum) \
- ((mp)->attrstats |= (1 << (FFATTRSLOT + seqnum)))
+ ((mp)->attrstats |= ((seqset_t)1 << (FFATTRSLOT + seqnum)))
#define make_all_public(mp) \
((mp)->attrstats = 0)
#define FMTERR (-3) /* Message Format error */
#define FLD 0 /* Field returned */
#define FLDPLUS 1 /* Field returned with more to come */
-#define FLDEOF 2 /* Field returned ending at eom */
#define BODY 3 /* Body returned with more to come */
-#define BODYEOF 4 /* Body returned ending at eom */
#define FILEEOF 5 /* Reached end of input file */
+struct m_getfld_state;
+typedef struct m_getfld_state *m_getfld_state_t;
+
/*
* Maildrop styles
*/
#define MS_MMDF 3 /* string mmdlm2 */
#define MS_MSH 4 /* whacko msh */
-extern int msg_count; /* m_getfld() indicators */
-extern int msg_style; /* .. */
-extern char *msg_delim; /* .. */
-
#define NOUSE 0 /* draft being re-used */
#define TFOLDER 0 /* path() given a +folder */
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
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;
-extern char *installproc;
extern char *lproc;
extern char *mailproc;
extern char *mh_defaults;
extern char *msgprot;
extern char *mshproc;
extern char *nmhaccessftp;
+extern char *nmhaccessurl;
extern char *nmhstorage;
extern char *nmhcache;
extern char *nmhprivcache;