]>
diplodocus.org Git - nmh/blob - docs/historical/mh-6.8.5/h/mh.h
1 /* mh.h - main header file for all of MH */
2 /* @(#)$Id: mh.h,v 2.19 1993/02/26 21:53:29 jromine Exp $ */
5 /* Well-used constants */
7 #define NOTOK (-1) /* syscall()s return this on error */
8 #define OK 0 /* ditto on success */
9 #define DONE 1 /* trinary logic */
11 #define NULLCP ((char *) 0)
12 #define NULLVP ((char **) 0)
13 #define Nbby 8 /* number of bits/byte */
15 #define MAXARGS 1000 /* max arguments to exec */
17 #define NFOLDERS 300 /* max folder arguments on command line */
20 #define MAXFOLDER 1000 /* message increment */
22 #define MAXFOLDER 1500 /* message increment */
24 #define DMAXFOLDER 4 /* typical number of digits */
26 #if (!defined(BSD42) && !defined(BSD41A) && !defined(VMUNIX) && !defined(hpux)) || defined(_AIX)
28 #endif /* not BSD */ /* how sad... */
32 /* profile structure */
35 char *n_name
; /* key */
36 char *n_field
; /* value */
38 char n_context
; /* context, not profile */
40 struct node
*n_next
; /* next entry */
44 /* switches structure */
46 #define AMBIGSW (-2) /* from smatch() on ambiguous switch */
47 #define UNKWNSW (-1) /* ditto on unknown switch */
54 extern struct swit anoyes
[]; /* standard yes/no switches */
57 /* messages structure */
60 int hghmsg
; /* Highest msg in directory */
61 int nummsg
; /* Actual Number of msgs */
62 int lowmsg
; /* Lowest msg number */
63 int curmsg
; /* Number of current msg if any */
65 int lowsel
; /* Lowest selected msg number */
66 int hghsel
; /* Highest selected msg number */
67 int numsel
; /* Number of msgs selected */
69 char *foldpath
; /* Pathname of folder */
71 int msgflags
; /* Folder status bits */
73 char pad1
[sizeof (int) - sizeof (char)];
75 #define READONLY 0x01 /* No write access to folder */
76 #define SEQMOD 0x02 /* folder's sequences modifed */
77 #define MHPATH 0x04 /* mhpath-style folder handling */
78 #define OTHERS 0x08 /* folder has other files */
79 #define MODIFIED 0x10 /* msh in-core folder modified */
80 #define FBITS "\020\01READONLY\02SEQMOD\03MHPATH\04OTHERS\05MODIFIED"
82 /* Note well: msgstats[] is a int, so we have 16 or 32 bits to work
83 with. The first 5 are for standard MH message flags,
84 this leaves us 11 (or 27) for user-defined attributes. Of
85 these, 1 is reserved for future internal use, so this leaves
87 #define NATTRS ((sizeof(int)*Nbby)-6) /* see above */
88 char *msgattrs
[NATTRS
+ 1];/* folder attributes */
89 int attrstats
; /* public=0/private=1 */
91 int lowoff
; /* low element in msgstats[] */
92 int hghoff
; /* hgh element in msgstats[] */
95 int msgstats
[1]; /* msg status */
97 int *msgbase
; /* msg base */
98 int *msgstats
; /* msg status */
100 #define EXISTS 0x0001 /* exists */
101 #define DELETED 0x0002 /* deleted */
102 #define SELECTED 0x0004 /* selected for use */
103 #define SELECT_EMPTY 0x0008 /* mhpath "new" */
104 #define UNSEEN 0x0010 /* inc/show "unseen" */
105 #define FFATTRSLOT 5 /* user-defined attributes */
106 /* first free slot is */
107 /* (1 << 5) or 0x20 */
108 #define MBITS "\020\01EXISTS\02DELETED\03SELECTED\04NEW\05UNSEEN"
111 #define MHSIZE(mp,lo,hi) \
112 ((unsigned) (sizeof *mp + ((hi) + 2) * sizeof *mp -> msgstats))
114 #define MHSIZE(mp,lo,hi) ((unsigned) sizeof *mp)
115 #define MHSIZEX(mp,lo,hi) \
116 ((unsigned) (((hi) - (lo) + 1) * sizeof *mp -> msgstats))
120 #define NULLMP ((struct msgs *) 0)
124 /* m_getfld() message parsing */
126 #define NAMESZ 128 /* Limit on component name size */
128 #define LENERR (-2) /* Name too long error from getfld */
129 #define FMTERR (-3) /* Message Format error */
130 #define FLD 0 /* Field returned */
131 #define FLDPLUS 1 /* Field " with more to come */
132 #define FLDEOF 2 /* Field " ending at eom */
133 #define BODY 3 /* Body " with more to come */
134 #define BODYEOF 4 /* Body " ending at eom */
135 #define FILEEOF 5 /* Reached end of input file */
138 /* Maildrop styles */
140 #define MS_DEFAULT 0 /* default (one msg per file) */
141 #define MS_UNKNOWN 1 /* type not known yet */
142 #define MS_UUCP 2 /* Unix-style "from" lines */
143 #define MS_MMDF 3 /* string mmdlm2 */
144 #define MS_MSH 4 /* whacko msh */
146 extern int msg_count
; /* m_getfld() indicators */
147 extern int msg_style
; /* .. */
148 extern char *msg_delim
; /* .. */
151 #define NOUSE 0 /* draft being re-used */
153 #define TFOLDER 0 /* path() given a +folder */
154 #define TFILE 1 /* path() given a file */
155 #define TSUBCWF 2 /* path() given a @folder */
159 #endif /* not LINK */
163 #endif /* not SBACKUP */
166 #define OUTPUTLINELEN 72 /* default line length for headers */
171 * These standard strings are defined in config.c. They are the
172 * only system-dependent parameters in MH, and thus by redefining
173 * their values and reloading the various modules, MH will run
177 extern char *components
;
178 extern char *context
;
179 extern char *current
;
181 extern char *digestcomps
;
182 extern char *distcomps
;
184 extern char *faceproc
;
185 extern char *fileproc
;
186 extern char *foldprot
;
187 extern char *forwcomps
;
189 extern char *incproc
;
190 extern char *installproc
;
192 extern char *mailproc
;
193 extern char *mh_defaults
;
194 extern char *mh_profile
;
196 extern char *mhlformat
;
197 extern char *mhlforward
;
198 extern char *mhlproc
;
199 extern char *moreproc
;
200 extern char *msgprot
;
201 extern char *mshproc
;
202 extern char *nsequence
;
203 extern char *packproc
;
204 extern char *postproc
;
205 extern char *pfolder
;
206 extern char *psequence
;
207 extern char *rcvdistcomps
;
208 extern char *replcomps
;
209 extern char *rmfproc
;
210 extern char *rmmproc
;
211 extern char *sendproc
;
212 extern char *showproc
;
213 extern char *slocalproc
;
215 extern char *usequence
;
216 extern char *version
;
217 extern char *vmhproc
;
218 extern char *whatnowproc
;
219 extern char *whomproc
;
223 /* global variables -sigh- */
225 extern char ctxflags
;
226 #define CTXMOD 0x01 /* context information modified */
227 #define DBITS "\020\01CTXMOD"
232 #endif /* OVERHEAD */
234 extern char *invo_name
; /* pgm invocation name */
235 extern char *mypath
; /* user's $HOME */
236 extern char *defpath
; /* pathname of user's profile */
237 extern char *ctxpath
; /* pathname of user's context */
239 extern struct node
*m_defs
;
243 /* from the MH subroutine library */
280 char *m_getfolder ();
282 struct msgs
*m_gmsg ();
288 struct msgs
*m_remsg ();
309 #define pidXwait(id,cp) pidstatus (pidwait (id, NOTOK), stdout, cp)
331 #include "../h/strings.h"
333 /* should be in <stdio.h> */
335 #if !defined(SYS5) && !defined(ncr) && !defined(_AIX) && !defined(OSF1) && !defined(__convex__) && !defined(__386BSD__) && !defined(BSD44)
336 typedef struct _iobuf
*FP
;
345 #if !defined(BSD42) && !defined(hpux) && !defined(ncr) && !defined(_AIX) && !defined(RENAME)
346 #define rename(f1,f2) (link (f1, f2) != NOTOK ? unlink (f1) : NOTOK)
347 #endif /* not BSD42 */
349 #define setsig(s,f) if (signal (s, SIG_IGN) != SIG_IGN) \
351 #define setsigx(i,s,f) if ((i = signal (s, SIG_IGN)) != SIG_IGN) \
354 #if defined(sun) && !defined(NFS)
359 #define ruserpass _ruserpass
362 #if (defined(BSD44) || defined(SUN40) || defined(hpux) \
363 || defined(_AIX) || defined (sgi)) && !defined(UNISTD)