X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/3f1f199234e06fdbd18c10860f19bdd1706a0f76..39ecf70bb:/h/mh.h?ds=sidebyside diff --git a/h/mh.h b/h/mh.h index 77671f8d..dda0c3d2 100644 --- a/h/mh.h +++ b/h/mh.h @@ -30,14 +30,15 @@ #endif typedef unsigned char boolean; /* not int so we can pack in a structure */ -/* If we're using gcc then give it some information about - * functions that abort. - */ +/* If we're using gcc then tell it extra information so it can do more + * compile-time checks. */ #if __GNUC__ > 2 #define NORETURN __attribute__((__noreturn__)) +#define CHECK_PRINTF(fmt, arg) __attribute__((format(printf, fmt, arg))) #define NMH_UNUSED(i) (void) i #else #define NORETURN +#define CHECK_PRINTF(fmt, arg) #define NMH_UNUSED(i) i #endif @@ -353,8 +354,6 @@ struct msgs { #define other_files(mp) ((mp)->msgflags & OTHERS) #define set_other_files(mp) ((mp)->msgflags |= OTHERS) -#define NULLMP ((struct msgs *) 0) - /* * m_getfld() message parsing */ @@ -369,23 +368,31 @@ struct msgs { followed by a colon. Add one for terminating NULL. */ -#define LENERR (-2) /* Name too long error from getfld */ -#define FMTERR (-3) /* Message Format error */ -#define FLD 0 /* Field returned */ -#define FLDPLUS 1 /* Field returned with more to come */ -#define BODY 3 /* Body returned with more to come */ -#define FILEEOF 5 /* Reached end of input file */ +/* Token type or error returned from m_getfld(), and its internal state + * for the next call. */ +/* FLD detects the header's name is too long to fit in the fixed size + * array. */ +#define LENERR (-2) +/* FLD reaches EOF after the header's name, or the name is followed by + * a linefeed rather than a colon and the body buffer isn't large enough + * to pretend this header line starts the body. */ +#define FMTERR (-3) +/* The initial state, looking for headers. Returned when the header's + * value finishes. */ +#define FLD 0 +/* Another chunk of the header's value has been returned, but there's + * more to come. */ +#define FLDPLUS 1 +/* A chunk of the email's body has been returned. */ +#define BODY 3 +/* Either the end of the input file has been reached, or the delimiter + * between emails has been found and the caller should + * m_getfld_state_reset() to reset the state to FLD for continuing + * through the file. */ +#define FILEEOF 5 typedef struct m_getfld_state *m_getfld_state_t; -/* - * Maildrop styles - */ -#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 NOUSE 0 /* draft being re-used */ #define TFOLDER 0 /* path() given a +folder */ @@ -432,13 +439,6 @@ 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