1: /* config.c - master MH configuration file */
2:
3: /* @(MHWARNING) */
4:
5: /* LINTLIBRARY */
6:
7: #include "../h/mh.h"
8: #ifdef MHRC
9: #include <pwd.h>
10: #endif MHRC
11: #include <stdio.h>
12:
13:
14: #define binpath(file) "@(MHBINPATH)/file"
15: #define etcpath(file) "@(MHETCPATH)/file"
16:
17:
18: @(MHCONFIG)
19:
20:
21: #ifdef MHRC
22: #ifdef SYS5
23: struct passwd *getpwnam ();
24: #endif SYS5
25: #endif MHRC
26:
27: /* */
28:
29: static char lpath[BUFSIZ];
30:
31: char *libpath (file)
32: char *file;
33: {
34: char *cp;
35: #ifdef MHRC
36: char *pp;
37: struct passwd *pw;
38: #endif MHRC
39:
40: #ifdef MHRC
41: m_getdefs ();
42: #endif MHRC
43:
44: switch (*file) {
45: case '/':
46: return file;
47:
48: #ifdef MHRC
49: case '~':
50: if (cp = index (pp = file + 1, '/'))
51: *cp++ = NULL;
52: if (*pp == NULL)
53: pp = mypath;
54: else
55: if (pw = getpwnam (pp))
56: pp = pw -> pw_dir;
57: else {
58: if (cp)
59: *--cp = '/';
60: goto try_it;
61: }
62:
63: (void) sprintf (lpath, "%s/%s", pp, cp ? cp : "");
64: if (cp)
65: *--cp = '/';
66:
67: if (access (lpath, 04) != NOTOK)
68: return lpath; /* else fall */
69: try_it: ;
70: #endif MHRC
71:
72: default:
73: if (access ((cp = m_maildir (file)), 04) != NOTOK)
74: return cp;
75: }
76:
77: (void) sprintf (lpath, etcpath (%s), file);
78: return (access (lpath, 04) != NOTOK ? lpath : file);
79: }
80:
81: /* */
82:
83: /*
84: * Standard yes/no switches structure
85: */
86:
87: struct swit anoyes[] = {
88: "no", 0,
89: "yes", 0,
90: NULL, NULL
91: };
92:
93: /* */
94:
95: /*
96: * MH constants
97: */
98:
99: char *components = "components";
100: char *current = "cur";
101: char *defalt = "inbox";
102: char *digestcomps = "digestcomps";
103: char *distcomps = "distcomps";
104: char *draft = "draft";
105: char *forwcomps = "forwcomps";
106: char *mh_defaults = etcpath (mh.profile);
107: char *mh_profile = ".mh_profile";
108: char *mhlformat = "mhl.format";
109: char *mhlforward = "mhl.forward";
110: char *nsequence = "Sequence-Negation";
111: char *pfolder = "Current-Folder";
112: char *psequence = "Previous-Sequence";
113: char *rcvdistcomps = "rcvdistcomps";
114: char *replcomps = "replcomps";
115: char *usequence = "Unseen-Sequence";
116:
117:
118: /*
119: * MH not-so constants
120: */
121:
122: char *context = "context";
123: #ifndef NOMHSEQ
124: char *mh_seq = ".mh_sequences";
125: #else NOMHSEQ
126: char *mh_seq = NULL;
127: #endif NOMHSEQ
128:
129:
130: /*
131: * MH globals
132: */
133:
134: char ctxflags; /* status of user's context */
135:
136: char *invo_name; /* pgm invocation name */
137: char *mypath; /* user's $HOME */
138: char *defpath; /* pathname of user's profile */
139: char *ctxpath; /* pathname of user's context */
140:
141: struct node *m_defs; /* profile/context structure */
142:
143: /* */
144:
145: /*
146: * MH processes
147: */
148:
149:
150: /*
151: * This program is usually called directly by users, but it is
152: * also invoked by the post program to process an "fcc".
153: */
154:
155: char *fileproc = binpath (refile);
156:
157:
158: /*
159: * This program is called to incorporate messages into a folder.
160: */
161:
162: char *incproc = binpath (inc);
163:
164:
165: /*
166: * When a user runs an MH program for the first time, this program
167: * is called to create his MH profile, and mail directory.
168: */
169:
170: char *installproc = etcpath (install-mh);
171:
172:
173: /*
174: * This is the program invoked by a "list" response to "What now?"
175: * whereas, showproc is the program invoked by show, next, prev.
176: */
177:
178: #ifndef MORE
179: char *lproc = "/usr/ucb/more";
180: #else MORE
181: char *lproc = MORE;
182: #endif MORE
183:
184:
185: /*
186: * This is the path for the Bell equivalent mail program.
187: */
188:
189: char *mailproc = binpath (mhmail);
190:
191:
192: /*
193: * mhl runs this program as a front-end.
194: */
195:
196: #ifndef MORE
197: char *moreproc = "/usr/ucb/more";
198: #else MORE
199: char *moreproc = MORE;
200: #endif MORE
201:
202:
203: /*
204: * This program is mhl - the nifty message lister
205: */
206:
207: char *mhlproc = etcpath (mhl);
208:
209:
210: /*
211: * This is the super handy BBoard reading program, which is really just the MH
212: * shell program
213: */
214:
215: char *mshproc = binpath (msh);
216:
217:
218: /*
219: * This program is called to pack a folder.
220: */
221:
222: char *packproc = binpath (packf);
223:
224:
225: /*
226: * This is the delivery program called through send to
227: * actually deliver mail to users. This is the interface to
228: * the MTS.
229: */
230:
231: #if BERK && SENDMTS
232: char *postproc = etcpath (spost);
233: #else
234: char *postproc = etcpath (post);
235: #endif BERK
236:
237:
238: /*
239: * This program is called to remove a folder.
240: */
241:
242: char *rmfproc = binpath (rmf);
243:
244:
245: /*
246: * This program is called to remove a message by rmm or refile -nolink.
247: * It's usually empty, which means to rename the file to a backup name.
248: */
249:
250: char *rmmproc = NULL;
251:
252:
253: /*
254: * This program is usually called by the user's whatnowproc, but it
255: * may also be called directly to send a message previously composed.
256: */
257:
258: char *sendproc = binpath (send);
259:
260:
261: /*
262: * This program is called to list messages by the show program.
263: * By setting showproc to mhl, the user can run mhl instead.
264: */
265:
266: #ifndef MORE
267: char *showproc = "/usr/ucb/more";
268: #else MORE
269: char *showproc = MORE;
270: #endif MORE
271:
272:
273: /*
274: * This program is called under stand-alone MH to deliver a message to
275: * a local user. Under other MTS's it can be used to emulate a
276: * MMDF-II .maildelivery mechanism.
277: */
278:
279: char *slocalproc = etcpath (slocal);
280:
281:
282: /*
283: * This program is called by vmh as the back-end to the window management
284: * protocol
285: */
286:
287: char *vmhproc = binpath (msh);
288:
289:
290: /*
291: * This program is called after comp, et. al., have built a draft
292: */
293:
294: char *whatnowproc = binpath (whatnow);
295:
296:
297: /*
298: * This program is called to list/validate the addresses in a message.
299: */
300:
301: char *whomproc = binpath (whom);
302:
303: /* */
304:
305: /*
306: * This is the editor invoked by the various message composition
307: * programs. It SHOULD be a 2-D scope editor, such as Rand's ned
308: * or Berkeley's ex, but any editor will work. We use prompter as
309: * the default, since with -prepend it works just fine with forw.
310: */
311:
312: char *sysed = "@(MHEDITOR)";
313:
314:
315: /*
316: * This is the MH alias file.
317: */
318:
319: char *AliasFile = etcpath (MailAliases);
320:
321: /* */
322:
323: /*
324: * File protections
325: */
326:
327:
328: /*
329: * Folders (directories) are created with this protection (mode)
330: */
331:
332: #ifndef FOLDPROT
333: #define FOLDPROT "0711"
334: #endif not FOLDPROT
335:
336: char *foldprot = FOLDPROT;
337:
338:
339: /*
340: * Every NEW message will be created with this protection. When a
341: * message is filed it retains its protection, so this only applies
342: * to messages coming in through inc.
343: */
344:
345: #ifndef MSGPROT
346: #define MSGPROT "0644"
347: #endif not MSGPROT
348:
349: char *msgprot = MSGPROT;
Defined functions
Defined variables
lpath
defined in line
29; used 6 times
Defined macros