2 ** mh.h -- main header file for all of nmh
10 #define NOTOK (-1) /* syscall()s return this on error */
11 #define OK 0 /* ditto on success */
12 #define DONE 1 /* trinary logic */
14 #define Nbby 8 /* number of bits/byte */
16 #define MAXARGS 1000 /* max arguments to exec */
17 #define NFOLDERS 1000 /* max folder arguments on command line */
18 #define DMAXFOLDER 4 /* typical number of digits */
19 #define MAXFOLDER 1000 /* message increment */
27 typedef unsigned char boolean; /* not int so we can pack in a structure */
29 /* If we're using gcc then give it some information about
30 ** functions that abort.
33 # define NORETURN __attribute__((__noreturn__))
39 ** user context/profile structure
42 char *n_name; /* key */
43 char *n_field; /* value */
44 char n_context; /* context, not profile */
45 struct node *n_next; /* next entry */
51 #define AMBIGSW (-2) /* from smatch() on ambiguous switch */
52 #define UNKWNSW (-1) /* from smatch() on unknown switch */
57 ** The minchars field is apparently used like this:
59 ** -# : Switch can be abbreviated to # chars; switch hidden in -help.
60 ** 0 : Switch can't be abbreviated; switch shown in -help.
61 ** # : Switch can be abbreviated to # chars; switch shown in -help.
66 extern struct swit anoyes[]; /* standard yes/no switches */
69 ** general folder attributes
71 #define READONLY (1<<0) /* No write access to folder */
72 #define SEQMOD (1<<1) /* folder's sequences modifed */
73 #define ALLOW_BEYOND (1<<2) /* allow the beyond sequence */
74 #define OTHERS (1<<3) /* folder has other files */
76 #define FBITS "\020\01READONLY\02SEQMOD\03ALLOW_BEYOND\04OTHERS"
79 ** type for holding the sequence set of a message
81 typedef unsigned int seqset_t;
84 ** internal messages attributes (sequences)
86 #define EXISTS (1<<0) /* exists */
87 #define SELECTED (1<<1) /* selected for use */
88 #define SELECT_UNSEEN (1<<2) /* inc/show "unseen" */
90 #define MBITS "\020\01EXISTS\02SELECTED\03UNSEEN"
93 ** first free slot for user-defined sequences
98 ** Determine the number of user defined sequences we
99 ** can have. The first few sequence flags are for
100 ** internal nmh message flags.
102 #define NUMATTRS ((sizeof(seqset_t) * Nbby) - FFATTRSLOT)
105 ** Primary structure of folder/message information
108 int lowmsg; /* Lowest msg number */
109 int hghmsg; /* Highest msg number */
110 int nummsg; /* Actual Number of msgs */
112 int lowsel; /* Lowest selected msg number */
113 int hghsel; /* Highest selected msg number */
114 int numsel; /* Number of msgs selected */
116 int curmsg; /* Number of current msg if any */
118 int msgflags; /* Folder attributes (READONLY, etc) */
119 char *foldpath; /* Pathname of folder */
122 ** Name of sequences in this folder. We add an
123 ** extra slot, so we can NULL terminate the list.
125 char *msgattrs[NUMATTRS + 1];
128 ** bit flags for whether sequence
129 ** is public (0), or private (1)
134 ** These represent the lowest and highest possible
135 ** message numbers we can put in the message status
136 ** area, without calling folder_realloc().
142 ** This is an array of seqset_t which we allocate dynamically.
143 ** Each seqset_t is a set of bits flags for a particular message.
144 ** These bit flags represent general attributes such as
145 ** EXISTS, SELECTED, etc. as well as track if message is
146 ** in a particular sequence.
148 seqset_t *msgstats; /* msg status */
152 ** Amount of space to allocate for msgstats. Allocate
153 ** the array to have space for messages numbers lo to hi.
155 #define MSGSTATSIZE(mp,lo,hi) ((size_t) (((hi) - (lo) + 1) * sizeof(*(mp)->msgstats)))
157 #define NULLMP ((struct msgs *) 0)
160 ** m_getfld() message parsing
163 #define NAMESZ 999 /*
164 ** Limit on component name size.
165 ** RFC 2822 limits line lengths to
166 ** 998 characters, so a header name
167 ** can be at most that long.
168 ** m_getfld limits header names to 2
169 ** less than NAMESZ, which is fine,
170 ** because header names must be
171 ** followed by a colon. Add one for
175 #define LENERR (-2) /* Name too long error from getfld */
176 #define FMTERR (-3) /* Message Format error */
177 #define FLD 0 /* Field returned */
178 #define FLDPLUS 1 /* Field returned with more to come */
179 #define FLDEOF 2 /* Field returned ending at eom */
180 #define BODY 3 /* Body returned with more to come */
181 #define BODYEOF 4 /* Body returned ending at eom */
182 #define FILEEOF 5 /* Reached end of input file */
184 extern int msg_count; /* m_getfld() indicators (That's a hack!) */
186 #define NOUSE 0 /* draft being re-used */
188 #define OUTPUTLINELEN 72 /* default line length for headers */
191 ** miscellaneous macros
194 #define pidXwait(pid,cp) pidstatus(pidwait(pid, NOTOK), stdout, cp)
197 # define max(a,b) ((a) > (b) ? (a) : (b))
201 # define min(a,b) ((a) < (b) ? (a) : (b))
207 #define CTXMOD 0x01 /* context information modified */
208 #define DBITS "\020\01CTXMOD"
209 extern char ctxflags;
211 extern char *invo_name; /* command invocation name */
212 extern char *mypath; /* user's $HOME */
214 extern char *mmhpath;
215 extern char *defpath; /* pathname of user's profile */
216 extern char *ctxpath; /* pathname of user's context */
217 extern struct node *m_defs; /* list of profile/context entries */
218 extern char *mailstore; /* name of mail storage directory */
221 ** These standard strings are defined in config.c. They are the
222 ** only system-dependent parameters in nmh, and thus by redefining
223 ** their values and reloading the various modules, nmh will run
226 extern char *attach_hdr;
227 extern char *sign_hdr;
228 extern char *enc_hdr;
229 extern char *components;
230 extern char *context;
231 extern char *curfolder;
232 extern char *defaulteditor;
233 extern char *defaultpager;
234 extern char *defaultfolder;
235 extern char *digestcomps;
236 extern char *distcomps;
237 extern char *draftfolder;
238 extern char *foldprot;
239 extern char *forwcomps;
241 extern char *listproc;
242 extern char *mhetcdir;
243 extern char *mailspool;
245 extern char *mhlformat;
246 extern char *mhlreply;
247 extern char *mimetypequery;
248 extern char *mimetypequeryproc;
249 extern char *msgprot;
250 extern char *nmhstorage;
251 extern char *nsequence;
252 extern char *profile;
253 extern char *psequence;
254 extern char *rcvdistcomps;
255 extern char *replcomps;
256 extern char *replgroupcomps;
257 extern char *sendmail;
258 extern char *seq_all;
259 extern char *seq_beyond;
260 extern char *seq_cur;
261 extern char *seq_first;
262 extern char *seq_last;
263 extern char *seq_next;
264 extern char *seq_prev;
265 extern char *seq_unseen;
266 extern char *seq_neg;
267 extern char *trashfolder;
268 extern char *usequence;
269 extern char *version_num;
270 extern char *version_str;
271 extern char *whatnowproc;
273 extern void (*done) (int) NORETURN;
275 #include <h/prototypes.h>