Added all of the MH sources, including RCS files, in
[mmh] / docs / historical / mh-6.8.5 / h / RCS / mh.h,v
1 head    2.19;
2 access;
3 symbols;
4 locks; strict;
5 comment @ * @;
6
7
8 2.19
9 date    93.02.26.21.53.29;      author jromine; state Exp;
10 branches;
11 next    2.18;
12
13 2.18
14 date    92.12.14.17.10.43;      author jromine; state Exp;
15 branches;
16 next    2.17;
17
18 2.17
19 date    92.11.24.20.24.06;      author jromine; state Exp;
20 branches;
21 next    2.16;
22
23 2.16
24 date    92.11.17.20.42.05;      author jromine; state Exp;
25 branches;
26 next    2.15;
27
28 2.15
29 date    92.11.04.00.32.42;      author jromine; state Exp;
30 branches;
31 next    2.14;
32
33 2.14
34 date    92.11.02.18.52.04;      author jromine; state Exp;
35 branches;
36 next    2.13;
37
38 2.13
39 date    92.10.27.16.57.25;      author jromine; state Exp;
40 branches;
41 next    2.12;
42
43 2.12
44 date    92.05.12.21.47.13;      author jromine; state Exp;
45 branches;
46 next    2.11;
47
48 2.11
49 date    92.02.11.00.38.12;      author jromine; state Exp;
50 branches;
51 next    2.10;
52
53 2.10
54 date    92.02.04.00.00.59;      author jromine; state Exp;
55 branches;
56 next    2.9;
57
58 2.9
59 date    92.02.03.16.34.21;      author jromine; state Exp;
60 branches;
61 next    2.8;
62
63 2.8
64 date    92.01.31.21.37.07;      author jromine; state Exp;
65 branches;
66 next    2.7;
67
68 2.7
69 date    92.01.24.00.03.50;      author jromine; state Exp;
70 branches;
71 next    2.6;
72
73 2.6
74 date    90.04.05.15.06.09;      author sources; state Exp;
75 branches;
76 next    2.5;
77
78 2.5
79 date    90.03.27.19.14.05;      author sources; state Exp;
80 branches;
81 next    2.4;
82
83 2.4
84 date    90.02.23.14.28.50;      author sources; state Exp;
85 branches;
86 next    2.3;
87
88 2.3
89 date    90.02.23.14.27.01;      author sources; state Exp;
90 branches;
91 next    2.2;
92
93 2.2
94 date    90.02.05.14.19.54;      author sources; state Exp;
95 branches;
96 next    2.1;
97
98 2.1
99 date    90.02.01.13.20.04;      author sources; state Exp;
100 branches;
101 next    2.0;
102
103 2.0
104 date    89.11.17.15.56.55;      author sources; state Exp;
105 branches;
106 next    1.1;
107
108 1.1
109 date    89.06.26.15.41.03;      author sources; state Exp;
110 branches;
111 next    ;
112
113
114 desc
115 @@
116
117
118 2.19
119 log
120 @386BSD/BSD44
121 @
122 text
123 @/* mh.h - main header file for all of MH */
124 /* @@(#)$Id: mh.h,v 2.18 1992/12/14 17:10:43 jromine Exp jromine $ */
125
126
127 /* Well-used constants */
128
129 #define NOTOK           (-1)    /* syscall()s return this on error */
130 #define OK              0       /*  ditto on success */
131 #define DONE            1       /* trinary logic */
132 #define ALL             ""
133 #define NULLCP          ((char *) 0)
134 #define NULLVP          ((char **) 0)
135 #define Nbby            8       /* number of bits/byte */
136
137 #define MAXARGS         1000    /* max arguments to exec */
138
139 #define NFOLDERS         300    /* max folder arguments on command line */
140
141 #ifndef UCI
142 #define MAXFOLDER       1000    /* message increment */
143 #else
144 #define MAXFOLDER       1500    /* message increment */
145 #endif
146 #define DMAXFOLDER         4    /* typical number of digits */
147
148 #if (!defined(BSD42) && !defined(BSD41A) && !defined(VMUNIX) && !defined(hpux)) || defined(_AIX)
149 #define vfork           fork
150 #endif  /* not BSD */           /* how sad... */
151
152 /* \f */
153
154 /* profile structure */
155
156 struct node {
157     char   *n_name;             /* key */
158     char   *n_field;            /* value */
159
160     char    n_context;          /* context, not profile */
161
162     struct node *n_next;        /* next entry */
163 };
164
165
166 /* switches structure */
167
168 #define AMBIGSW         (-2)    /* from smatch() on ambiguous switch */
169 #define UNKWNSW         (-1)    /*  ditto on unknown switch */
170
171 struct swit {
172     char   *sw;
173     int     minchars;
174 };
175
176 extern struct swit  anoyes[];   /* standard yes/no switches */
177
178
179 /* messages structure */
180
181 struct msgs {
182     int     hghmsg;             /* Highest msg in directory     */
183     int     nummsg;             /* Actual Number of msgs        */
184     int     lowmsg;             /* Lowest msg number            */
185     int     curmsg;             /* Number of current msg if any */
186
187     int     lowsel;             /* Lowest selected msg number   */
188     int     hghsel;             /* Highest selected msg number  */
189     int     numsel;             /* Number of msgs selected      */
190
191     char   *foldpath;           /* Pathname of folder           */
192
193     int     msgflags;           /* Folder status bits           */
194 #ifndef MTR
195     char    pad1[sizeof (int) - sizeof (char)];
196 #endif /* not MTR */
197 #define READONLY  0x01          /*     No write access to folder */
198 #define SEQMOD    0x02          /*     folder's sequences modifed */
199 #define MHPATH    0x04          /*     mhpath-style folder handling */
200 #define OTHERS    0x08          /*     folder has other files   */
201 #define MODIFIED  0x10          /*     msh in-core folder modified */
202 #define FBITS   "\020\01READONLY\02SEQMOD\03MHPATH\04OTHERS\05MODIFIED"
203
204 /* Note well: msgstats[] is a int, so we have 16 or 32 bits to work
205         with.  The first 5 are for standard MH message flags,
206         this leaves us 11 (or 27) for user-defined attributes.  Of
207         these, 1 is reserved for future internal use, so this leaves
208         users 10 (or 26).                                       */
209 #define NATTRS  ((sizeof(int)*Nbby)-6)          /*  see above   */
210     char   *msgattrs[NATTRS + 1];/* folder attributes           */
211     int     attrstats;          /* public=0/private=1           */
212
213     int     lowoff;             /* low element in msgstats[] */
214     int     hghoff;             /* hgh element in msgstats[] */
215
216 #ifndef MTR
217     int     msgstats[1];        /* msg status                   */
218 #else /* MTR */
219     int    *msgbase;            /* msg base                     */
220     int    *msgstats;           /* msg status                   */
221 #endif /* MTR */
222 #define EXISTS          0x0001  /*     exists                   */
223 #define DELETED         0x0002  /*     deleted                  */
224 #define SELECTED        0x0004  /*     selected for use         */
225 #define SELECT_EMPTY    0x0008  /*     mhpath "new"             */
226 #define UNSEEN          0x0010  /*     inc/show "unseen"        */
227 #define FFATTRSLOT      5       /*     user-defined attributes  */
228                                 /*      first free slot is      */
229                                 /*      (1 << 5) or 0x20        */
230 #define MBITS   "\020\01EXISTS\02DELETED\03SELECTED\04NEW\05UNSEEN"
231
232 #ifndef MTR
233 #define MHSIZE(mp,lo,hi)        \
234                 ((unsigned) (sizeof *mp + ((hi) + 2) * sizeof *mp -> msgstats))
235 #else /* MTR */
236 #define MHSIZE(mp,lo,hi)        ((unsigned) sizeof *mp)
237 #define MHSIZEX(mp,lo,hi)       \
238                 ((unsigned) (((hi) - (lo) + 1) * sizeof *mp -> msgstats))
239 #endif /* MTR */
240 };
241
242 #define NULLMP  ((struct msgs *) 0)
243
244 /* \f */
245
246 /* m_getfld() message parsing */
247
248 #define NAMESZ  128             /* Limit on component name size         */
249
250 #define LENERR  (-2)            /* Name too long error from getfld      */
251 #define FMTERR  (-3)            /* Message Format error                 */
252 #define FLD      0              /* Field returned                       */
253 #define FLDPLUS  1              /* Field " with more to come            */
254 #define FLDEOF   2              /* Field " ending at eom                */
255 #define BODY     3              /* Body  " with more to come            */
256 #define BODYEOF  4              /* Body  " ending at eom                */
257 #define FILEEOF  5              /* Reached end of input file            */
258
259
260 /* Maildrop styles */
261
262 #define MS_DEFAULT      0       /* default (one msg per file) */
263 #define MS_UNKNOWN      1       /* type not known yet */
264 #define MS_UUCP         2       /* Unix-style "from" lines */
265 #define MS_MMDF         3       /* string mmdlm2 */
266 #define MS_MSH          4       /* whacko msh */
267
268 extern int msg_count;           /* m_getfld() indicators */
269 extern int msg_style;           /*  .. */
270 extern char *msg_delim;         /*  .. */
271
272
273 #define NOUSE   0               /* draft being re-used */
274
275 #define TFOLDER 0               /* path() given a +folder */
276 #define TFILE   1               /* path() given a file */
277 #define TSUBCWF 2               /* path() given a @@folder */
278
279 #ifndef LINK
280 #define LINK    "@@"
281 #endif /* not LINK */
282
283 #ifndef SBACKUP
284 #define SBACKUP ","
285 #endif /* not SBACKUP */
286
287
288 #define OUTPUTLINELEN   72      /* default line length for headers */
289
290 /* \f */
291
292 /*
293  * These standard strings are defined in config.c.  They are the
294  * only system-dependent parameters in MH, and thus by redefining
295  * their values and reloading the various modules, MH will run
296  * on any system.
297  */
298
299 extern char *components;
300 extern char *context;
301 extern char *current;
302 extern char *defalt;
303 extern char *digestcomps;
304 extern char *distcomps;
305 extern char *draft;
306 extern char *faceproc;
307 extern char *fileproc;
308 extern char *foldprot;
309 extern char *forwcomps;
310 extern char *inbox;
311 extern char *incproc;
312 extern char *installproc;
313 extern char *lproc;
314 extern char *mailproc;
315 extern char *mh_defaults;
316 extern char *mh_profile;
317 extern char *mh_seq;
318 extern char *mhlformat;
319 extern char *mhlforward;
320 extern char *mhlproc;
321 extern char *moreproc;
322 extern char *msgprot;
323 extern char *mshproc;
324 extern char *nsequence;
325 extern char *packproc;
326 extern char *postproc;
327 extern char *pfolder;
328 extern char *psequence;
329 extern char *rcvdistcomps;
330 extern char *replcomps;
331 extern char *rmfproc;
332 extern char *rmmproc;
333 extern char *sendproc;
334 extern char *showproc;
335 extern char *slocalproc;
336 extern char *sysed;
337 extern char *usequence;
338 extern char *version;
339 extern char *vmhproc;
340 extern char *whatnowproc;
341 extern char *whomproc;
342
343 /* \f */
344
345 /* global variables -sigh- */
346
347 extern char ctxflags;
348 #define CTXMOD  0x01            /* context information modified */
349 #define DBITS   "\020\01CTXMOD"
350
351 #ifdef  OVERHEAD
352 extern int  fd_def;
353 extern int  fd_ctx;
354 #endif /* OVERHEAD */
355
356 extern char *invo_name;         /* pgm invocation name */
357 extern char *mypath;            /* user's $HOME */
358 extern char *defpath;           /* pathname of user's profile */
359 extern char *ctxpath;           /* pathname of user's context */
360
361 extern struct node *m_defs;
362
363 /* \f */
364
365 /* from the MH subroutine library */
366
367 char   *add ();
368 void    adios ();
369 void    admonish ();
370 void    advise ();
371 void    advertise ();
372 void    ambigsw ();
373 int     atooi ();
374 char  **brkstring ();
375 void    closefds ();
376 char   *concat ();
377 char   *copy ();
378 char  **copyip ();
379 void    cpydata ();
380 void    cpydgst ();
381 void    discard ();
382 void    done ();
383 int     fdcompare ();
384 int     gans ();
385 char  **getans ();
386 int     getanswer ();
387 char   *getcpy ();
388 void    help ();
389 char   *libpath ();
390 int     m_atoi ();
391 char   *m_backup ();
392 int     m_convert ();
393 int     m_delete ();
394 char   *m_draft ();
395 void    m_eomsbr ();
396 int     m_file ();
397 char   *m_find ();
398 void    m_fmsg ();
399 void    m_foil ();
400 void    m_getdefs ();
401 int     m_getfld ();
402 char   *m_getfolder ();
403 int     m_gmprot ();
404 struct msgs *m_gmsg ();
405 char   *m_maildir ();
406 char   *m_mailpath ();
407 char   *m_name ();
408 int     m_putenv ();
409 void    m_readefs ();
410 struct msgs *m_remsg ();
411 void    m_replace ();
412 char   *m_scratch ();
413 char   *m_seq ();
414 int     m_seqadd ();
415 char   *m_seqbits ();
416 int     m_seqdel ();
417 int     m_seqflag ();
418 int     m_seqnew ();
419 void    m_setcur ();
420 void    m_setseq ();
421 void    m_setvis ();
422 void    m_sync ();
423 char   *m_tmpfil ();
424 void    m_unknown ();
425 void    m_update ();
426 int     m_whatnow ();
427 int     makedir ();
428 char   *path ();
429 int     peekc ();
430 int     pidwait ();
431 #define pidXwait(id,cp) pidstatus (pidwait (id, NOTOK), stdout, cp)
432 int     pidstatus ();
433 void    printsw ();
434 void    push ();
435 char   *pwd ();
436 char   *r1bindex ();
437 int     refile ();
438 int     remdir ();
439 int     showfile ();
440 int     smatch ();
441 char   *sprintb();
442 int     ssequal ();
443 int     stringdex ();
444 char   *trimcpy ();
445 int     type ();
446 int     uleq ();
447 int     unputenv ();
448 int     uprf ();
449 int     vfgets ();
450
451 /* \f */
452
453 #include "../h/strings.h"
454
455 /* should be in <stdio.h> */
456
457 #if     !defined(SYS5) && !defined(ncr) && !defined(_AIX) && !defined(OSF1) && !defined(__convex__) && !defined(__386BSD__) && !defined(BSD44)
458 typedef struct _iobuf  *FP;
459 FP   popen ();
460 #else /* SYS5 */
461 #define FP      FILE*
462 #endif /* SYS5 */
463
464
465 /* miscellaneous */
466
467 #if !defined(BSD42) && !defined(hpux) && !defined(ncr) && !defined(_AIX) && !defined(RENAME)
468 #define rename(f1,f2)   (link (f1, f2) != NOTOK ? unlink (f1) : NOTOK)
469 #endif  /* not BSD42 */
470
471 #define setsig(s,f)     if (signal (s, SIG_IGN) != SIG_IGN) \
472                             (void) signal (s, f)
473 #define setsigx(i,s,f)  if ((i = signal (s, SIG_IGN)) != SIG_IGN) \
474                             (void) signal (s, f)
475
476 #if     defined(sun) && !defined(NFS)
477 #define NFS
478 #endif
479
480 #ifdef  NFS
481 #define ruserpass       _ruserpass
482 #endif
483
484 #if (defined(BSD44) || defined(SUN40) || defined(hpux) \
485         || defined(_AIX) || defined (sgi)) && !defined(UNISTD)
486 #define       UNISTD
487 #endif
488 @
489
490
491 2.18
492 log
493 @convex
494 @
495 text
496 @d2 1
497 a2 1
498 /* @@(#)$Id: mh.h,v 2.17 1992/11/24 20:24:06 jromine Exp jromine $ */
499 d335 1
500 a335 1
501 #if     !defined(SYS5) && !defined(ncr) && !defined(_AIX) && !defined(OSF1) && !defined(__convex__)
502 @
503
504
505 2.17
506 log
507 @add OSF1 define
508 @
509 text
510 @d2 1
511 a2 1
512 /* @@(#)$Id: mh.h,v 2.16 1992/11/17 20:42:05 jromine Exp jromine $ */
513 d335 1
514 a335 1
515 #if     !defined(SYS5) && !defined(ncr) && !defined(_AIX) && !defined(OSF1)
516 @
517
518
519 2.16
520 log
521 @drop TYPESIG
522 @
523 text
524 @d2 1
525 a2 1
526 /* @@(#)$Id: mh.h,v 2.15 1992/11/04 00:32:42 jromine Exp jromine $ */
527 d335 1
528 a335 1
529 #if     !defined(SYS5) && !defined(ncr) && !defined(_AIX)
530 @
531
532
533 2.15
534 log
535 @putenv -> m_putenv
536 @
537 text
538 @d2 1
539 a2 1
540 /* @@(#)$Id: mh.h,v 2.14 1992/11/02 18:52:04 jromine Exp jromine $ */
541 a352 8
542
543 #ifndef TYPESIG
544 #ifdef  SUN40
545 #define TYPESIG void
546 #else   /* use old V7 default */
547 #define TYPESIG int
548 #endif
549 #endif /* not TYPESIG */
550 @
551
552
553 2.14
554 log
555 @rename NBBY
556 use _AIX instead of AIX
557 @
558 text
559 @d2 1
560 a2 1
561 /* @@(#)$Id: mh.h,v 2.13 1992/10/27 16:57:25 jromine Exp jromine $ */
562 d286 1
563 a312 1
564 int     putenv ();
565 @
566
567
568 2.13
569 log
570 @UNISTD, RENAME
571 @
572 text
573 @d2 1
574 a2 1
575 /* @@(#)$Id: mh.h,v 2.12 1992/05/12 21:47:13 jromine Exp jromine $ */
576 d13 1
577 a13 1
578 #define NBBY            8       /* number of bits/byte */
579 d87 1
580 a87 1
581 #define NATTRS  ((sizeof(int)*NBBY)-6)          /*  see above   */
582 d371 1
583 a371 1
584         || defined(AIX) || defined (sgi)) && !defined(UNISTD)
585 @
586
587
588 2.12
589 log
590 @fix ifdefs
591 @
592 text
593 @d2 1
594 a2 1
595 /* @@(#)$Id: mh.h,v 2.11 1992/02/11 00:38:12 jromine Exp jromine $ */
596 a332 1
597
598 d345 1
599 a345 1
600 #if !defined(BSD42) && !defined(hpux) && !defined(ncr) && !defined(_AIX)
601 d368 5
602 @
603
604
605 2.11
606 log
607 @allow 32-bit for user-defined sequences
608 @
609 text
610 @d2 1
611 a2 1
612 /* @@(#)$Id: mh.h,v 2.10 1992/02/04 00:00:59 jromine Exp $ */
613 d74 1
614 a74 1
615 #endif  not MTR
616 d96 1
617 a96 1
618 #else   MTR
619 d99 1
620 a99 1
621 #endif  MTR
622 d113 1
623 a113 1
624 #else   MTR
625 d117 1
626 a117 1
627 #endif  MTR
628 d159 1
629 a159 1
630 #endif  not LINK
631 d163 1
632 a163 1
633 #endif  not SBACKUP
634 d232 1
635 a232 1
636 #endif  OVERHEAD
637 d339 1
638 a339 1
639 #else   SYS5
640 d341 1
641 a341 1
642 #endif  SYS5
643 d361 1
644 a361 1
645 #endif  not TYPESIG
646 @
647
648
649 2.10
650 log
651 @contributed patch
652 @
653 text
654 @d2 1
655 a2 1
656 /* @@(#)$Id: mh.h,v 2.9 1992/02/03 16:34:21 jromine Exp jromine $ */
657 d13 1
658 d71 1
659 a71 1
660     char    msgflags;           /* Folder status bits           */
661 d82 1
662 a82 1
663 /* Note well: msgstats[] is a short, so we have 16 bits to work
664 d84 4
665 a87 4
666         this leaves us 11 for user-defined attributes.  Of these,
667         1 is reserved for future internal use, so this leaves
668         users 10.                                               */
669 #define NATTRS  10              /* could be 11, see above       */
670 d89 1
671 a89 4
672     short   attrstats;          /* public=0/private=1           */
673 #ifndef MTR
674     char    pad2[sizeof (int) - sizeof (short)];
675 #endif  not MTR
676 d95 1
677 a95 1
678     short   msgstats[1];        /* msg status                   */
679 d97 2
680 a98 2
681     short  *msgbase;            /* msg base                     */
682     short  *msgstats;           /* msg status                   */
683 @
684
685
686 2.9
687 log
688 @kerberos
689 @
690 text
691 @d2 1
692 a2 1
693 /* @@(#)$Id: mh.h,v 2.8 1992/01/31 21:37:07 jromine Exp jromine $ */
694 d190 1
695 @
696
697
698 2.8
699 log
700 @kerberos
701 @
702 text
703 @d2 1
704 a2 1
705 /* @@(#)$Id: mh.h,v 2.7 1992/01/24 00:03:50 jromine Exp jromine $ */
706 d113 1
707 a113 1
708 #define MSIZE(mp,lo,hi) \
709 d116 2
710 a117 2
711 #define MSIZE(mp,lo,hi) ((unsigned) sizeof *mp)
712 #define MSIZEX(mp,lo,hi)        \
713 @
714
715
716 2.7
717 log
718 @ncr changes
719 MAXFOLDER = 1500 at UCI
720 @
721 text
722 @d2 1
723 a2 1
724 /* @@(#)$Id: mh.h,v 2.6 1990/04/05 15:06:09 sources Exp jromine $ */
725 d25 1
726 a25 1
727 #if !defined(BSD42) && !defined(BSD41A) && !defined(VMUNIX) && !defined(hpux)
728 d27 1
729 a27 1
730 #endif  not BSD                 /* how sad... */
731 d337 1
732 a337 1
733 #if     !defined(SYS5) && !defined(ncr)
734 d347 1
735 a347 1
736 #if !defined(BSD42) && !defined(hpux) && !defined(ncr)
737 d349 1
738 a349 1
739 #endif  not BSD42
740 @
741
742
743 2.6
744 log
745 @add ID
746 @
747 text
748 @d2 1
749 a2 1
750 /* @@(#)$Id:$ */
751 d18 1
752 d20 3
753 d337 1
754 a337 1
755 #ifndef SYS5
756 d347 1
757 a347 1
758 #if !defined(BSD42) && !defined(hpux)
759 @
760
761
762 2.5
763 log
764 @some hpux fixes
765 @
766 text
767 @d2 1
768 @
769
770
771 2.4
772 log
773 @TYPESIG
774 @
775 text
776 @d342 1
777 a342 1
778 #ifndef BSD42
779 d344 1
780 a344 1
781 #endif  BSD42
782 @
783
784
785 2.3
786 log
787 @TYPESIG defaulting on SYS5/SUN40 systems
788 @
789 text
790 @d352 1
791 a352 1
792 #if     defined (SYS5) || defined (SUN40)
793 @
794
795
796 2.2
797 log
798 @TYPESIG
799 @
800 text
801 @d352 3
802 d356 1
803 @
804
805
806 2.1
807 log
808 @up NFOLDERS to 300
809 @
810 text
811 @d351 4
812 @
813
814
815 2.0
816 log
817 @changes for SUN40 shared libraries and NNTP under bbc
818 @
819 text
820 @d15 1
821 a15 1
822 #define NFOLDERS         100    /* max folder arguments on command line */
823 @
824
825
826 1.1
827 log
828 @Initial revision
829 @
830 text
831 @d20 1
832 a20 1
833 #ifndef BSD42 || BSD41A || VMUNIX || hpux
834 @