]> diplodocus.org Git - nmh/blob - docs/historical/mh-jun-1982/mh.h
Replaced use of snprintf() with memcpy()/memmove().
[nmh] / docs / historical / mh-jun-1982 / mh.h
1 #ifdef COMMENT
2 Proprietary Rand Corporation, 1981.
3 Further distribution of this software
4 subject to the terms of the Rand
5 license agreement.
6 #endif
7
8 /* mh.h - main header file for all of mh */
9
10 /* VOID is used to indicate explicitly that the value of a function
11 /* is to be ignored.
12 /* If you have a newer C compiler, it is better to simply say:
13 #define VOID (void)
14 /* instead of what follows
15 /**/
16 # define void int
17 # ifdef lint
18 # define VOID _VOID_ = (int)
19 int _VOID_;
20 # else
21 # define VOID
22 # endif
23
24 /* #define ARPANET /* if you are on the ARPANET */
25
26 /* #define VMUNIX /* if you are running a Berkeley system */
27 /* if you define VMUNIX, then define JOBSLIB=-ljobs in progs/Makefile */
28
29 #ifdef ARPANET
30 #define NOGATEWAY
31 #ifdef NOGATEWAY
32 extern char *rhosts[];
33 #endif NOGATEWAY
34 #endif ARPANET
35
36 #define ALL ""
37 #define NULLCP (char *)0
38
39 #define MAXFOLDER 999 /* Max number of messages in a folder */
40 #define DMAXFOLDER 3 /* Number of digits in MAXFOLDER */
41
42 #define MAXARGS 1000 /* Max messages to exec */
43
44 /* Flag bits in msgstats */
45 #define EXISTS 01 /* Message exists */
46 #define DELETED 02 /* Deleted undefined currently */
47 #define SELECTED 04 /* Message selected by an arg */
48 #define SELECT_EMPTY 010/* Single empty msg selected by an mhpath arg */
49
50 #define READONLY 01 /* No write access to folder */
51 #define DEFMOD 01 /* In-core profile has been modified */
52
53 /*#define NEWS 1 /* Define for news inclusion */
54
55 struct swit {
56 char *sw;
57 int minchars;
58 };
59
60 /*
61 * m_gmsg() returns this structure. It contains the per folder
62 * information which is obtained from reading the folder directory.
63 */
64
65 struct msgs {
66 int hghmsg; /* Highest msg in directory */
67 int nummsg; /* Actual Number of msgs */
68 int lowmsg; /* Lowest msg number */
69 int curmsg; /* Number of current msg if any */
70 int lowsel; /* Lowest selected msg number */
71 int hghsel; /* Highest selected msg number */
72 int numsel; /* Number of msgs selected */
73 char *foldpath; /* Pathname of folder */
74 char selist, /* Folder has a "select" file */
75 msgflags, /* Folder status bits */
76 filler,
77 others; /* Folder has other file(s) */
78 char msgstats[1]; /* Stat bytes for each msg */
79 };
80
81 /* m_getfld definitions and return values */
82
83 #define NAMESZ 64 /* Limit on component name size */
84 #define LENERR -2 /* Name too long error from getfld */
85 #define FMTERR -3 /* Message Format error */
86
87 /* m_getfld return codes */
88 #define FLD 0 /* Field returned */
89 #define FLDPLUS 1 /* Field " with more to come */
90 #define FLDEOF 2 /* Field " ending at eom */
91 #define BODY 3 /* Body " with more to come */
92 #define BODYEOF 4 /* Body " ending at eom */
93 #define FILEEOF 5 /* Reached end of input file */
94
95 /*
96 * These standard strings are defined in strings.a. They are the
97 * only system-dependent parameters in MH, and thus by redefining
98 * their values and reloading the various modules, MH will run
99 * on any system.
100 */
101
102 extern char
103 *components, /* Name of user's component file (in mh dir) */
104 *current, /* Name of current msg file in a folder */
105 *defalt, /* Name of the std folder (inbox) */
106 *distcomps, /* Name of `dist' components file */
107 *draft, /* Name of the normal draft file */
108 *fileproc, /* Path of file program */
109 *foldprot, /* Default folder protection */
110 /* *hostname, /* Local net host name */
111 *installproc, /* Name of auto-install program path */
112 /* *layout, /* Name of mhl layout file */
113 *listname, /* Default selection list folder name */
114 *lockdir, /* Dir for lock files (Same fs as mailboxes)*/
115 *lproc, /* Path of "list" prog for "What now?" */
116 *lsproc, /* Path of the block style ls program */
117 *mailboxes, /* Incoming mail directory */
118 *mailproc, /* Path of Bell equivalent mail pgm, used by news -send */
119 *mh_prof, /* Name of users profile file */
120 *mh_deliver, /* Name of deliverer for mh */
121 *mhlformat, /* Name of mhl format file in MH dir */
122 *mhlstdfmt, /* Name of standard mhl format file */
123 *mhnews, /* Name of MH news file */
124 *msgprot, /* Default message protection (s.a. 0664) */
125 *pfolder, /* Name of current folder profile entry */
126 *prproc, /* Path of the pr program */
127 *scanproc, /* Path of the scan program */
128 *showproc, /* Path of the type (l) program */
129 *sendproc, /* Path of the send message program */
130 *stdcomps, /* Std comp file if missing user's own */
131 *stddcomps, /* Std dist file if missing user's own */
132 *sysed; /* Path of the std (e) editor */
133
134 /* Just about every program uses this also via m_getdefs */
135 char *mypath; /* User's log-on path */
136
137 /*
138 * node structure used to hold a linked list of the users profile
139 * information taken from logpath/.mh_prof.
140 */
141
142 struct node {
143 struct node *n_next;
144 char *n_name,
145 *n_field;
146 } *m_defs;
147
148 char def_flags;
149
150
151 /*
152 * The first char in the mhnews file indicates whether the program
153 * calling m_news() should continue running or halt.
154 */
155
156 #define NEWSHALT '!' /* Halt after showing the news */
157 #define NEWSCONT ' ' /* Continue (ditto) */
158 #define NEWSPAUSE '\001' /* Pause during news output... */
159
160
161 /*
162 * Miscellaneous Defines to speed things up
163 */
164
165 #define error(str) { fprintf(stderr, "%s\n", str); exit(-1); }
166
167 /*
168 * Routine type declarations -- needed by version 7 compiler
169 */
170
171 char *invo_name;
172 char **brkstring();
173 char *m_maildir();
174 char *m_find();
175 char *m_name();
176 char *concat();
177 char *getcpy();
178 char *trimcpy();
179 char *add();
180 char **copyip();
181 char *getcpy();
182 char *m_getfolder();
183 struct msgs *m_gmsg();
184 char *copy();
185 char **getans();
186 char *cdate();
187 char *makename();
188 char *r1bindex();
189 char *pwd();
190 char *path();
191
192 /*
193 * Routine type declarations -- SHOULD BE GLOBAL
194 */
195 char *getenv();
196
197 /*
198 * Defines for path evaluation type--routine path second arg:
199 */
200
201 #define TFOLDER 0
202 #define TF