0
|
1 /* mh.h - main header file for all of MH */
|
|
2 /* @(#)$Id$ */
|
|
3
|
|
4
|
|
5 /* Well-used constants */
|
|
6
|
|
7 #define NOTOK (-1) /* syscall()s return this on error */
|
|
8 #define OK 0 /* ditto on success */
|
|
9 #define DONE 1 /* trinary logic */
|
|
10 #define ALL ""
|
|
11 #define NULLCP ((char *) 0)
|
|
12 #define NULLVP ((char **) 0)
|
|
13 #define Nbby 8 /* number of bits/byte */
|
|
14
|
|
15 #define MAXARGS 1000 /* max arguments to exec */
|
|
16
|
|
17 #ifndef NFOLDERS
|
|
18 #define NFOLDERS 1000 /* max folder arguments on command line */
|
|
19 #endif
|
|
20
|
|
21 #ifndef UCI
|
|
22 #define MAXFOLDER 1000 /* message increment */
|
|
23 #else
|
|
24 #define MAXFOLDER 1500 /* message increment */
|
|
25 #endif
|
|
26 #define DMAXFOLDER 4 /* typical number of digits */
|
|
27
|
|
28 #if (!defined(BSD42) && !defined(BSD41A) && !defined(VMUNIX) && !defined(hpux)) || defined(_AIX)
|
|
29 #define vfork fork
|
|
30 #endif /* not BSD */ /* how sad... */
|
|
31
|
|
32 /* */
|
|
33
|
|
34 /* profile structure */
|
|
35
|
|
36 struct node {
|
|
37 char *n_name; /* key */
|
|
38 char *n_field; /* value */
|
|
39
|
|
40 char n_context; /* context, not profile */
|
|
41
|
|
42 struct node *n_next; /* next entry */
|
|
43 };
|
|
44
|
|
45
|
|
46 /* switches structure */
|
|
47
|
|
48 #define AMBIGSW (-2) /* from smatch() on ambiguous switch */
|
|
49 #define UNKWNSW (-1) /* ditto on unknown switch */
|
|
50
|
|
51 struct swit {
|
|
52 char *sw;
|
|
53 int minchars;
|
|
54 };
|
|
55
|
|
56 extern struct swit anoyes[]; /* standard yes/no switches */
|
|
57
|
|
58
|
|
59 /* messages structure */
|
|
60
|
|
61 struct msgs {
|
|
62 int hghmsg; /* Highest msg in directory */
|
|
63 int nummsg; /* Actual Number of msgs */
|
|
64 int lowmsg; /* Lowest msg number */
|
|
65 int curmsg; /* Number of current msg if any */
|
|
66
|
|
67 int lowsel; /* Lowest selected msg number */
|
|
68 int hghsel; /* Highest selected msg number */
|
|
69 int numsel; /* Number of msgs selected */
|
|
70
|
|
71 char *foldpath; /* Pathname of folder */
|
|
72
|
|
73 int msgflags; /* Folder status bits */
|
|
74 #ifndef MTR
|
|
75 char pad1[sizeof (int) - sizeof (char)];
|
|
76 #endif /* not MTR */
|
|
77 #define READONLY 0x01 /* No write access to folder */
|
|
78 #define SEQMOD 0x02 /* folder's sequences modifed */
|
|
79 #define MHPATH 0x04 /* mhpath-style folder handling */
|
|
80 #define OTHERS 0x08 /* folder has other files */
|
|
81 #define MODIFIED 0x10 /* msh in-core folder modified */
|
|
82 #define FBITS "\020\01READONLY\02SEQMOD\03MHPATH\04OTHERS\05MODIFIED"
|
|
83
|
|
84 /* Note well: msgstats[] is a int, so we have 16 or 32 bits to work
|
|
85 with. The first 5 are for standard MH message flags,
|
|
86 this leaves us 11 (or 27) for user-defined attributes. Of
|
|
87 these, 1 is reserved for future internal use, so this leaves
|
|
88 users 10 (or 26). */
|
|
89 #define NATTRS ((sizeof(int)*Nbby)-6) /* see above */
|
|
90 char *msgattrs[NATTRS + 1];/* folder attributes */
|
|
91 int attrstats; /* public=0/private=1 */
|
|
92
|
|
93 int lowoff; /* low element in msgstats[] */
|
|
94 int hghoff; /* hgh element in msgstats[] */
|
|
95
|
|
96 #ifndef MTR
|
|
97 int msgstats[1]; /* msg status */
|
|
98 #else /* MTR */
|
|
99 int *msgbase; /* msg base */
|
|
100 int *msgstats; /* msg status */
|
|
101 #endif /* MTR */
|
|
102 #define EXISTS 0x0001 /* exists */
|
|
103 #define DELETED 0x0002 /* deleted */
|
|
104 #define SELECTED 0x0004 /* selected for use */
|
|
105 #define SELECT_EMPTY 0x0008 /* mhpath "new" */
|
|
106 #define UNSEEN 0x0010 /* inc/show "unseen" */
|
|
107 #define FFATTRSLOT 5 /* user-defined attributes */
|
|
108 /* first free slot is */
|
|
109 /* (1 << 5) or 0x20 */
|
|
110 #define MBITS "\020\01EXISTS\02DELETED\03SELECTED\04NEW\05UNSEEN"
|
|
111
|
|
112 #ifndef MTR
|
|
113 #define MHSIZE(mp,lo,hi) \
|
|
114 ((unsigned) (sizeof *mp + ((hi) + 2) * sizeof *mp -> msgstats))
|
|
115 #else /* MTR */
|
|
116 #define MHSIZE(mp,lo,hi) ((unsigned) sizeof *mp)
|
|
117 #define MHSIZEX(mp,lo,hi) \
|
|
118 ((unsigned) (((hi) - (lo) + 1) * sizeof *mp -> msgstats))
|
|
119 #endif /* MTR */
|
|
120 };
|
|
121
|
|
122 #define NULLMP ((struct msgs *) 0)
|
|
123
|
|
124 /* */
|
|
125
|
|
126 /* m_getfld() message parsing */
|
|
127
|
|
128 #define NAMESZ 128 /* Limit on component name size */
|
|
129
|
|
130 #define LENERR (-2) /* Name too long error from getfld */
|
|
131 #define FMTERR (-3) /* Message Format error */
|
|
132 #define FLD 0 /* Field returned */
|
|
133 #define FLDPLUS 1 /* Field " with more to come */
|
|
134 #define FLDEOF 2 /* Field " ending at eom */
|
|
135 #define BODY 3 /* Body " with more to come */
|
|
136 #define BODYEOF 4 /* Body " ending at eom */
|
|
137 #define FILEEOF 5 /* Reached end of input file */
|
|
138
|
|
139
|
|
140 /* Maildrop styles */
|
|
141
|
|
142 #define MS_DEFAULT 0 /* default (one msg per file) */
|
|
143 #define MS_UNKNOWN 1 /* type not known yet */
|
|
144 #define MS_UUCP 2 /* Unix-style "from" lines */
|
|
145 #define MS_MMDF 3 /* string mmdlm2 */
|
|
146 #define MS_MSH 4 /* whacko msh */
|
|
147
|
|
148 extern int msg_count; /* m_getfld() indicators */
|
|
149 extern int msg_style; /* .. */
|
|
150 extern char *msg_delim; /* .. */
|
|
151
|
|
152
|
|
153 #define NOUSE 0 /* draft being re-used */
|
|
154
|
|
155 #define TFOLDER 0 /* path() given a +folder */
|
|
156 #define TFILE 1 /* path() given a file */
|
|
157 #define TSUBCWF 2 /* path() given a @folder */
|
|
158
|
|
159 #ifndef LINK
|
|
160 #define LINK "@"
|
|
161 #endif /* not LINK */
|
|
162
|
|
163 #ifndef SBACKUP
|
|
164 #define SBACKUP ","
|
|
165 #endif /* not SBACKUP */
|
|
166
|
|
167
|
|
168 #define OUTPUTLINELEN 72 /* default line length for headers */
|
|
169
|
|
170 /* */
|
|
171
|
|
172 /*
|
|
173 * These standard strings are defined in config.c. They are the
|
|
174 * only system-dependent parameters in MH, and thus by redefining
|
|
175 * their values and reloading the various modules, MH will run
|
|
176 * on any system.
|
|
177 */
|
|
178
|
|
179 extern char *components;
|
|
180 extern char *context;
|
|
181 extern char *current;
|
|
182 extern char *defalt;
|
|
183 extern char *digestcomps;
|
|
184 extern char *distcomps;
|
|
185 extern char *draft;
|
|
186 extern char *faceproc;
|
|
187 extern char *fileproc;
|
|
188 extern char *foldprot;
|
|
189 extern char *forwcomps;
|
|
190 extern char *inbox;
|
|
191 extern char *incproc;
|
|
192 extern char *installproc;
|
|
193 extern char *lproc;
|
|
194 extern char *mailproc;
|
|
195 extern char *mh_defaults;
|
|
196 extern char *mh_profile;
|
|
197 extern char *mh_seq;
|
|
198 extern char *mhlformat;
|
|
199 extern char *mhlforward;
|
|
200 extern char *mhlproc;
|
|
201 extern char *moreproc;
|
|
202 extern char *msgprot;
|
|
203 extern char *mshproc;
|
|
204 extern char *nsequence;
|
|
205 extern char *packproc;
|
|
206 extern char *postproc;
|
|
207 extern char *pfolder;
|
|
208 extern char *psequence;
|
|
209 extern char *rcvdistcomps;
|
|
210 extern char *replcomps;
|
|
211 extern char *rmfproc;
|
|
212 extern char *rmmproc;
|
|
213 extern char *sendproc;
|
|
214 extern char *showproc;
|
|
215 extern char *slocalproc;
|
|
216 extern char *sysed;
|
|
217 extern char *usequence;
|
|
218 extern char *version;
|
|
219 extern char *vmhproc;
|
|
220 extern char *whatnowproc;
|
|
221 extern char *whomproc;
|
|
222
|
|
223 /* */
|
|
224
|
|
225 /* global variables -sigh- */
|
|
226
|
|
227 extern char ctxflags;
|
|
228 #define CTXMOD 0x01 /* context information modified */
|
|
229 #define DBITS "\020\01CTXMOD"
|
|
230
|
|
231 #ifdef OVERHEAD
|
|
232 extern int fd_def;
|
|
233 extern int fd_ctx;
|
|
234 #endif /* OVERHEAD */
|
|
235
|
|
236 extern char *invo_name; /* pgm invocation name */
|
|
237 extern char *mypath; /* user's $HOME */
|
|
238 extern char *defpath; /* pathname of user's profile */
|
|
239 extern char *ctxpath; /* pathname of user's context */
|
|
240
|
|
241 extern struct node *m_defs;
|
|
242
|
|
243 /* */
|
|
244
|
|
245 /* from the MH subroutine library */
|
|
246
|
|
247 char *add ();
|
|
248 void adios ();
|
|
249 void admonish ();
|
|
250 void advise ();
|
|
251 void advertise ();
|
|
252 void ambigsw ();
|
|
253 int atooi ();
|
|
254 char **brkstring ();
|
|
255 void closefds ();
|
2
|
256 char *concat (char *first, ...);
|
0
|
257 char *copy ();
|
|
258 char **copyip ();
|
|
259 void cpydata ();
|
|
260 void cpydgst ();
|
|
261 void discard ();
|
|
262 void done ();
|
|
263 int fdcompare ();
|
|
264 int gans ();
|
|
265 char **getans ();
|
|
266 int getanswer ();
|
|
267 char *getcpy ();
|
|
268 void help ();
|
|
269 char *libpath ();
|
|
270 int m_atoi ();
|
|
271 char *m_backup ();
|
|
272 int m_convert ();
|
|
273 int m_delete ();
|
|
274 char *m_draft ();
|
|
275 void m_eomsbr ();
|
|
276 int m_file ();
|
|
277 char *m_find ();
|
|
278 void m_fmsg ();
|
|
279 void m_foil ();
|
|
280 void m_getdefs ();
|
|
281 int m_getfld ();
|
|
282 char *m_getfolder ();
|
|
283 int m_gmprot ();
|
|
284 struct msgs *m_gmsg ();
|
|
285 char *m_maildir ();
|
|
286 char *m_mailpath ();
|
|
287 char *m_name ();
|
|
288 int m_putenv ();
|
|
289 void m_readefs ();
|
|
290 struct msgs *m_remsg ();
|
|
291 void m_replace ();
|
|
292 char *m_scratch ();
|
|
293 char *m_seq ();
|
|
294 int m_seqadd ();
|
|
295 char *m_seqbits ();
|
|
296 int m_seqdel ();
|
|
297 int m_seqflag ();
|
|
298 int m_seqnew ();
|
|
299 void m_setcur ();
|
|
300 void m_setseq ();
|
|
301 void m_setvis ();
|
|
302 void m_sync ();
|
|
303 char *m_tmpfil ();
|
|
304 void m_unknown ();
|
|
305 void m_update ();
|
|
306 int m_whatnow ();
|
|
307 int makedir ();
|
|
308 char *path ();
|
|
309 int peekc ();
|
|
310 int pidwait ();
|
|
311 #define pidXwait(id,cp) pidstatus (pidwait (id, NOTOK), stdout, cp)
|
|
312 int pidstatus ();
|
|
313 void printsw ();
|
|
314 void push ();
|
|
315 char *pwd ();
|
|
316 char *r1bindex ();
|
|
317 int refile ();
|
|
318 int remdir ();
|
|
319 int showfile ();
|
|
320 int smatch ();
|
|
321 char *sprintb();
|
|
322 int ssequal ();
|
|
323 int stringdex ();
|
|
324 char *trimcpy ();
|
|
325 int type ();
|
|
326 int uleq ();
|
|
327 int unputenv ();
|
|
328 int uprf ();
|
|
329 int vfgets ();
|
|
330
|
|
331 /* */
|
|
332
|
|
333 #include "../h/strings.h"
|
|
334
|
|
335 /* should be in <stdio.h> */
|
|
336
|
|
337 #if !defined(SYS5) && !defined(ncr) && !defined(_AIX) && !defined(OSF1) && !defined(__osf__) && !defined(__convex__) && !defined(__386BSD__) && !defined(BSD44)
|
|
338 typedef struct _iobuf *FP;
|
|
339 FP popen ();
|
|
340 #else /* SYS5 */
|
|
341 #define FP FILE*
|
|
342 #endif /* SYS5 */
|
|
343
|
|
344
|
|
345 /* miscellaneous */
|
|
346
|
|
347 #if !defined(BSD42) && !defined(hpux) && !defined(ncr) && !defined(_AIX) && !defined(RENAME)
|
|
348 #define rename(f1,f2) (link (f1, f2) != NOTOK ? unlink (f1) : NOTOK)
|
|
349 #endif /* not BSD42 */
|
|
350
|
|
351 #define setsig(s,f) if (signal (s, SIG_IGN) != SIG_IGN) \
|
|
352 (void) signal (s, f)
|
|
353 #define setsigx(i,s,f) if ((i = signal (s, SIG_IGN)) != SIG_IGN) \
|
|
354 (void) signal (s, f)
|
|
355
|
|
356 #if defined(sun) && !defined(NFS)
|
|
357 #define NFS
|
|
358 #endif
|
|
359
|
|
360 #ifdef NFS
|
|
361 #define ruserpass _ruserpass
|
|
362 #endif
|
|
363
|
|
364 #if (defined(BSD44) || defined(SUN40) || defined(hpux) \
|
|
365 || defined(_AIX) || defined (sgi)) && !defined(UNISTD)
|
|
366 #define UNISTD
|
|
367 #endif
|
|
368
|
|
369 #ifdef JAPAN
|
|
370 /*
|
|
371 * Japanization patch (patchlevel.2)
|
|
372 * by Toshihiro Takada <takada@seraph.ntt.jp>
|
|
373 * especially thanks to
|
|
374 * hkojima@etl.go.jp (Hiroaki Kojima)
|
|
375 * UEHARA Tetsu=TaLow <tetsu@kutsuda.kuis.kyoto-u.ac.jp>
|
|
376 * and
|
|
377 * Hayashi Haruhisa <hayashi@lufiea10.kuic.kyoto-u.ac.jp>
|
|
378 */
|
|
379 void ml_init ();
|
|
380 int ml_ismlchar ();
|
|
381 int ml_ismlptr ();
|
|
382 void ml_fputs ();
|
|
383 void ml_pretty_fputs ();
|
|
384 void junet_fputs ();
|
|
385 char *ml_conv ();
|
5
|
386 char *ml_conv_decode ();
|
0
|
387 #endif /* JAPAN */
|
|
388 #ifdef MIME_HEADERS
|
|
389 char *exthdr_encode ();
|
|
390 char *exthdr_decode ();
|
|
391 #endif /* MIME_HEADERS */
|