*/
#define NOTOK (-1) /* syscall()s return this on error */
#define OK 0 /* ditto on success */
-#define DONE 1 /* trinary logic */
+#define DONE 1 /* ternary logic */
#define ALL ""
-#define Nbby 8 /* number of bits/byte */
#define MAXARGS 1000 /* max arguments to exec */
#define NFOLDERS 1000 /* max folder arguments on command line */
* This macro is for use by scan, for example, so that platforms with
* a small BUFSIZ can easily allocate larger buffers.
*/
-#define NMH_BUFSIZ (BUFSIZ>=8192 ? BUFSIZ : 8192)
+#define NMH_BUFSIZ max(BUFSIZ, 8192)
#ifndef FALSE
#define FALSE false
* terminating NUL. */
#define LEN(s) (sizeof (s) - 1)
+/* FENDNULL fends off NULL by giving an empty string instead. */
+#define FENDNULL(s) ((s) ? (s) : "")
+
/*
* char array that keeps track of size in both bytes and characters
* Usage note:
#define MBITS "\020\01EXISTS\02SELECTED\03NEW\04UNSEEN"
-/*
- * type for holding the sequence set of a message
- */
+/* A vector of bits for tracking the sequence membership of a single
+ * message. Do not access the struct members; use vector.c.
+ * Do not move or copy this struct as it may contain a pointer to
+ * itself; use bvector_copy(). */
+struct bvector {
+ unsigned long *bits;
+ size_t maxsize;
+ unsigned long tiny[2]; /* Default fixed-size storage for bits. */
+};
typedef struct bvector *bvector_t;
-bvector_t bvector_create (size_t /* initial size in bits, can be 0 */);
+bvector_t bvector_create (void);
+void bvector_init(struct bvector *bv);
void bvector_copy (bvector_t, bvector_t);
void bvector_free (bvector_t);
+void bvector_fini(struct bvector *bv);
void bvector_clear (bvector_t, size_t);
void bvector_clear_all (bvector_t);
void bvector_set (bvector_t, size_t);
unsigned int bvector_at (bvector_t, size_t);
-const unsigned long *bvector_bits (bvector_t);
-size_t bvector_maxsize (bvector_t);
+unsigned long bvector_first_bits (bvector_t);
typedef struct svector *svector_t;
int ivector_push_back (ivector_t, int);
int ivector_at (ivector_t, size_t);
int *ivector_atp (ivector_t, size_t);
-size_t ivector_size (ivector_t);
/*
* Primary structure of folder/message information
* in a particular sequence.
*/
size_t num_msgstats;
- bvector_t *msgstats; /* msg status */
+ struct bvector *msgstats; /* msg status */
/*
* A FILE handle containing an open filehandle for the sequence file
/*
* macros for message and sequence manipulation
*/
-#define msgstat(mp,n) (mp)->msgstats[(n) - mp->lowoff]
+#define msgstat(mp,n) ((mp)->msgstats + (n) - mp->lowoff)
#define clear_msg_flags(mp,msgnum) bvector_clear_all (msgstat(mp, msgnum))
#define copy_msg_flags(mp,i,j) bvector_copy (msgstat(mp,i), msgstat(mp,j))
#define get_msg_flags(mp,ptr,msgnum) bvector_copy (ptr, msgstat(mp, msgnum))
#define make_seq_private(mp,seqnum) \
bvector_set (mp->attrstats, FFATTRSLOT + seqnum)
#define make_all_public(mp) \
- mp->attrstats = bvector_create(0); bvector_clear_all (mp->attrstats)
+ mp->attrstats = bvector_create(); bvector_clear_all (mp->attrstats)
/*
* macros for folder attributes
#define other_files(mp) ((mp)->msgflags & OTHERS)
#define set_other_files(mp) ((mp)->msgflags |= OTHERS)
-#define NULLMP ((struct msgs *) 0)
-
/*
* m_getfld() message parsing
*/
#define MS_DEFAULT 0 /* default (one msg per file) */
#define MS_UNKNOWN 1 /* type not known yet */
#define MS_MBOX 2 /* Unix-style "from" lines */
-#define MS_MMDF 3 /* string mmdlm2 */
+#define MS_MMDF 3 /* string MMDF_DELIM */
#define NOUSE 0 /* draft being re-used */
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