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