Added all of the MH sources, including RCS files, in
[mmh] / docs / historical / mh-6.8.5 / conf / config / RCS / config.c,v
1 head    1.11;
2 access;
3 symbols;
4 locks; strict;
5 comment @ * @;
6
7
8 1.11
9 date    93.09.01.22.29.10;      author jromine; state Exp;
10 branches;
11 next    1.10;
12
13 1.10
14 date    93.09.01.22.27.24;      author jromine; state Exp;
15 branches;
16 next    1.9;
17
18 1.9
19 date    92.11.05.16.59.39;      author jromine; state Exp;
20 branches;
21 next    1.8;
22
23 1.8
24 date    92.02.04.00.00.37;      author jromine; state Exp;
25 branches;
26 next    1.7;
27
28 1.7
29 date    92.02.03.17.50.19;      author jromine; state Exp;
30 branches;
31 next    1.6;
32
33 1.6
34 date    92.01.31.21.37.07;      author jromine; state Exp;
35 branches;
36 next    1.5;
37
38 1.5
39 date    92.01.24.00.35.28;      author jromine; state Exp;
40 branches;
41 next    1.4;
42
43 1.4
44 date    90.04.05.15.28.59;      author sources; state Exp;
45 branches;
46 next    1.3;
47
48 1.3
49 date    90.04.05.14.42.15;      author sources; state Exp;
50 branches;
51 next    1.2;
52
53 1.2
54 date    90.03.17.09.55.46;      author sources; state Exp;
55 branches;
56 next    1.1;
57
58 1.1
59 date    90.03.17.09.55.12;      author sources; state Exp;
60 branches;
61 next    ;
62
63
64 desc
65 @@
66
67
68 1.11
69 log
70 @note mhlibdir subject to change
71 @
72 text
73 @/* config.c - master MH configuration file */
74 #ifndef lint
75 static char ident[] = "@@(#)$Id: config.c,v 1.10 1993/09/01 22:27:24 jromine Exp jromine $";
76 #endif  /* lint */
77
78 /* @@(MHWARNING) */
79
80 /* LINTLIBRARY */
81
82 #include "../h/mh.h"
83 #ifdef  MHRC
84 #include <pwd.h>
85 #endif /* MHRC */
86 #include <stdio.h>
87
88
89 #if     defined(__STDC__)
90 #define binpath(file) "@@(MHBINPATH)/"#file
91 #define etcpath(file) "@@(MHETCPATH)/"#file
92 #else
93 #define binpath(file) "@@(MHBINPATH)/file"
94 #define etcpath(file) "@@(MHETCPATH)/file"
95 #endif
96
97 static char Config[] = "@@(#)Config: @@(MHCONFIGFILE)";
98
99 @@(MHCONFIG)
100
101
102 #ifndef __STDC__
103 #ifdef  MHRC
104 #ifdef  SYS5
105 struct passwd *getpwnam ();
106 #endif /* SYS5 */
107 #endif /* MHRC */
108 #endif
109
110 /* \f */
111
112 static    char lpath[BUFSIZ];
113
114 char   *libpath (file)
115 char   *file;
116 {
117     char   *cp;
118 #ifdef  MHRC
119     char   *pp;
120     struct passwd  *pw;
121 #endif /* MHRC */
122
123 #ifdef  MHRC
124     m_getdefs ();
125 #endif /* MHRC */
126
127     switch (*file) {
128         case '/': 
129             return file;
130
131 #ifdef  MHRC
132         case '~': 
133             if (cp = index (pp = file + 1, '/'))
134                 *cp++ = '\0';
135             if (*pp == '\0')
136                 pp = mypath;
137             else
138                 if (pw = getpwnam (pp))
139                     pp = pw -> pw_dir;
140                 else {
141                     if (cp)
142                         *--cp = '/';
143                     goto try_it;
144                 }
145
146             (void) sprintf (lpath, "%s/%s", pp, cp ? cp : "");
147             if (cp)
148                 *--cp = '/';
149
150             if (access (lpath, 04) != NOTOK)
151                 return lpath;   /* else fall */
152     try_it: ;
153 #endif /* MHRC */
154
155         default: 
156             if (access ((cp = m_mailpath (file)), 04) != NOTOK)
157                 return cp;
158     }
159
160     (void) sprintf (lpath, etcpath (%s), file);
161     return (access (lpath, 04) != NOTOK ? lpath : file);
162 }
163
164 /* \f */
165
166 /* 
167  * Standard yes/no switches structure
168  */
169
170 struct swit anoyes[] = {
171     "no", 0,
172     "yes", 0,
173     NULL, 0
174 };
175
176 /* \f */
177
178 /* 
179  * MH constants
180  */
181
182 char   *components = "components";
183 char   *current = "cur";
184 char   *defalt = "inbox";
185 char   *digestcomps = "digestcomps";
186 char   *distcomps = "distcomps";
187 char   *draft = "draft";
188 char   *forwcomps = "forwcomps";
189 char   *inbox = "inbox";
190 char   *mh_defaults = etcpath (mh.profile);
191 char   *mh_profile = ".mh_profile";
192 char   *mhlformat = "mhl.format";
193 char   *mhlforward = "mhl.forward";
194 char   *nsequence = "Sequence-Negation";
195 char   *pfolder = "Current-Folder";
196 char   *psequence = "Previous-Sequence";
197 char   *rcvdistcomps = "rcvdistcomps";
198 char   *replcomps = "replcomps";
199 char   *usequence = "Unseen-Sequence";
200 char   *mhlibdir = "@@(MHETCPATH)";     /* NB: this will change */
201
202
203 /* 
204  * MH not-so constants
205  */
206
207 char   *context = "context";
208 #ifndef NOMHSEQ
209 char   *mh_seq = ".mh_sequences";
210 #else /* NOMHSEQ */
211 char   *mh_seq = NULL;
212 #endif /* NOMHSEQ */
213
214
215 /* 
216  * MH globals
217  */
218
219 char    ctxflags;               /* status of user's context */
220
221 char   *invo_name;              /* pgm invocation name */
222 char   *mypath;                 /* user's $HOME */
223 char   *defpath;                /* pathname of user's profile */
224 char   *ctxpath;                /* pathname of user's context */
225
226 struct node *m_defs;            /* profile/context structure */
227
228 /* \f */
229
230 /* 
231  * MH processes
232  */
233
234
235 /*
236  * mhl runs this program as a visual-end.
237  */
238
239 char   *faceproc = NULL;
240
241
242 /*
243  * This program is usually called directly by users, but it is
244  * also invoked by the post program to process an "fcc".
245  */
246
247 char   *fileproc = binpath (refile);
248
249
250 /* 
251  * This program is called to incorporate messages into a folder.
252  */
253
254 char   *incproc = binpath (inc);
255
256
257 /*
258  * When a user runs an MH program for the first time, this program
259  * is called to create his MH profile, and mail directory.
260  */
261
262 char   *installproc = etcpath (install-mh);
263
264
265 /*
266  * This is the program invoked by a "list" response to "What now?"
267  *  whereas, showproc is the program invoked by show, next, prev.
268  */
269
270 #ifndef MORE
271 char   *lproc = "/usr/ucb/more";
272 #else /* MORE */
273 char   *lproc = MORE;
274 #endif /* MORE */
275
276
277 /*
278  * This is the path for the Bell equivalent mail program.
279  */
280
281 char   *mailproc = binpath (mhmail);
282
283
284 /*
285  * mhl runs this program as a front-end.
286  */
287
288 #ifndef MORE
289 char   *moreproc = "/usr/ucb/more";
290 #else /* MORE */
291 char   *moreproc = MORE;
292 #endif /* MORE */
293
294
295 /* 
296  * This program is mhl - the nifty message lister
297  */
298
299 char    *mhlproc = etcpath (mhl);
300
301
302 /* 
303  * This is the super handy BBoard reading program, which is really just the MH
304  * shell program
305  */
306
307 char    *mshproc = binpath (msh);
308
309
310 /* 
311  * This program is called to pack a folder.  
312  */
313
314 char   *packproc = binpath (packf);
315
316
317 /*
318  * This is the delivery program called through send to
319  * actually deliver mail to users.  This is the interface to
320  * the MTS.
321  */
322
323 #if BERK && SENDMTS && !SMTP
324 char   *postproc = etcpath (spost);
325 #else
326 char   *postproc = etcpath (post);
327 #endif /* BERK */
328
329
330 /* 
331  * This program is called to remove a folder.  
332  */
333
334 char   *rmfproc = binpath (rmf);
335
336
337 /* 
338  * This program is called to remove a message by rmm or refile -nolink.
339  * It's usually empty, which means to rename the file to a backup name.
340  */
341
342 char   *rmmproc = NULL;
343
344
345 /*
346  * This program is usually called by the user's whatnowproc, but it
347  * may also be called directly to send a message previously composed.
348  */
349
350 char   *sendproc = binpath (send);
351
352
353 /*
354  * This program is called to list messages by the show program.
355  * By setting showproc to mhl, the user can run mhl instead.
356  */
357
358 #ifndef MORE
359 char   *showproc = "/usr/ucb/more";
360 #else /* MORE */
361 char   *showproc = MORE;
362 #endif /* MORE */
363
364
365 /* 
366  * This program is called under stand-alone MH to deliver a message to
367  * a local user.  Under other MTS's it can be used to emulate a
368  * MMDF-II .maildelivery mechanism.
369  */
370
371 char   *slocalproc = etcpath (slocal);
372
373
374 /* 
375  * This program is called by vmh as the back-end to the window management
376  * protocol
377  */
378
379 char    *vmhproc = binpath (msh);
380
381
382 /* 
383  * This program is called after comp, et. al., have built a draft
384  */
385
386 char    *whatnowproc = binpath (whatnow);
387
388
389 /* 
390  * This program is called to list/validate the addresses in a message.
391  */
392
393 char    *whomproc = binpath (whom);
394
395 /* \f */
396
397 /*
398  * This is the editor invoked by the various message composition
399  * programs.  It SHOULD be a 2-D scope editor, such as Rand's ned
400  * or Berkeley's ex, but any editor will work.  We use prompter as
401  * the default, since with -prepend it works just fine with forw.
402  */
403
404 char   *sysed = "@@(MHEDITOR)";
405
406
407 /* 
408  * This is the MH alias file.
409  */
410
411 char   *AliasFile = etcpath (MailAliases);
412
413 /* \f */
414
415 /* 
416  * File protections
417  */
418
419
420 /*
421  * Folders (directories) are created with this protection (mode)
422  */
423
424 #ifndef FOLDPROT
425 #define FOLDPROT        "0711"
426 #endif /* not FOLDPROT */
427
428 char   *foldprot = FOLDPROT;
429
430
431 /*
432  * Every NEW message will be created with this protection.  When a
433  * message is filed it retains its protection, so this only applies
434  * to messages coming in through inc.
435  */
436
437 #ifndef MSGPROT
438 #define MSGPROT         "0644"
439 #endif /* not MSGPROT */
440
441 char   *msgprot = MSGPROT;
442 @
443
444
445 1.10
446 log
447 @add mhlibdir for mhparam
448 @
449 text
450 @d3 1
451 a3 1
452 static char ident[] = "@@(#)$Id: config.c,v 1.9 1992/11/05 16:59:39 jromine Exp jromine $";
453 d128 1
454 a128 1
455 char   *mhlibdir = "@@(MHETCPATH)";
456 @
457
458
459 1.9
460 log
461 @#endif sugar
462 @
463 text
464 @d3 1
465 a3 1
466 static char ident[] = "@@(#)$Id: config.c,v 1.8 1992/02/04 00:00:37 jromine Exp jromine $";
467 d128 1
468 @
469
470
471 1.8
472 log
473 @contributed patch
474 @
475 text
476 @d3 2
477 a4 2
478 static char ident[] = "@@(#)$Id: config.c,v 1.7 1992/02/03 17:50:19 jromine Exp jromine $";
479 #endif  lint
480 d13 1
481 a13 1
482 #endif  MHRC
483 d34 2
484 a35 2
485 #endif  SYS5
486 #endif  MHRC
487 d49 1
488 a49 1
489 #endif  MHRC
490 d53 1
491 a53 1
492 #endif  MHRC
493 d81 1
494 a81 1
495 #endif  MHRC
496 d137 1
497 a137 1
498 #else   NOMHSEQ
499 d139 1
500 a139 1
501 #endif  NOMHSEQ
502 d199 1
503 a199 1
504 #else   MORE
505 d201 1
506 a201 1
507 #endif  MORE
508 d217 1
509 a217 1
510 #else   MORE
511 d219 1
512 a219 1
513 #endif  MORE
514 d254 1
515 a254 1
516 #endif BERK
517 d287 1
518 a287 1
519 #else   MORE
520 d289 1
521 a289 1
522 #endif  MORE
523 d353 1
524 a353 1
525 #endif  not FOLDPROT
526 d366 1
527 a366 1
528 #endif  not MSGPROT
529 @
530
531
532 1.7
533 log
534 @STDC
535 @
536 text
537 @d3 1
538 a3 1
539 static char ident[] = "@@(#)$Id: config.c,v 1.6 1992/01/31 21:37:07 jromine Exp jromine $";
540 d117 1
541 @
542
543
544 1.6
545 log
546 @kerberos
547 @
548 text
549 @d3 1
550 a3 1
551 static char ident[] = "@@(#)$Id: config.c,v 1.5 1992/01/24 00:35:28 jromine Exp jromine $";
552 d30 1
553 d36 1
554 @
555
556
557 1.5
558 log
559 @add config file string for "what"
560 @
561 text
562 @d3 1
563 a3 1
564 static char ident[] = "@@(#)$Id: config.c,v 1.4 1990/04/05 15:28:59 sources Exp jromine $";
565 d17 1
566 a17 1
567 #if     defined(__STDC__) && !defined(__HIGHC__)
568 d60 2
569 a61 2
570                 *cp++ = NULL;
571             if (*pp == NULL)
572 d99 1
573 a99 1
574     NULL, NULL
575 @
576
577
578 1.4
579 log
580 @add ID
581 @
582 text
583 @d3 1
584 a3 1
585 static char ident[] = "@@(#)$Id:$";
586 d25 1
587 @
588
589
590 1.3
591 log
592 @add ID
593 @
594 text
595 @d3 1
596 a3 1
597 static char ident[] = "$Id:";
598 @
599
600
601 1.2
602 log
603 @ANSI C fix from jeff honig
604 @
605 text
606 @d2 3
607 @
608
609
610 1.1
611 log
612 @Initial revision
613 @
614 text
615 @d14 4
616 d20 1
617 @