source: trunk/third/nmh/config/config.c @ 13183

Revision 13183, 7.9 KB checked in by danw, 26 years ago (diff)
change showproc from mhl to more
Line 
1
2/*
3 * config.c -- master nmh configuration file
4 *
5 * $Id: config.c,v 1.3 1999-06-07 15:55:26 danw Exp $
6 */
7
8#include <h/mh.h>
9
10#ifdef MHRC
11# include <pwd.h>
12#endif
13
14#define nmhbindir(file) NMHBINDIR#file
15#define nmhetcdir(file) NMHETCDIR#file
16#define nmhlibdir(file) NMHLIBDIR#file
17
18
19/*
20 * Find the location of a format or configuration
21 * file, and return its absolute pathname.
22 *
23 * 1) If already absolute pathname, then leave unchanged.
24 * 2) Next, if it begins with ~user, then expand it.
25 * 3) Next, check in nmh Mail directory.
26 * 4) Next, check in nmh `etc' directory.
27 *
28 */
29
30char *
31etcpath (char *file)
32{
33    static char epath[PATH_MAX];
34    char *cp;
35#ifdef MHRC
36    char *pp;
37    struct passwd *pw;
38#endif
39
40#ifdef MHRC
41    context_read();
42#endif
43
44    switch (*file) {
45        case '/':
46            /* If already absolute pathname, return it */
47            return file;
48
49#ifdef MHRC
50        case '~':
51            /* Expand ~username */
52            if ((cp = strchr(pp = file + 1, '/')))
53                *cp++ = '\0';
54            if (*pp == '\0') {
55                pp = mypath;
56            } else {
57                if ((pw = getpwnam (pp)))
58                    pp = pw->pw_dir;
59                else {
60                    if (cp)
61                        *--cp = '/';
62                    goto try_it;
63                }
64            }
65
66            snprintf (epath, sizeof(epath), "%s/%s", pp, cp ? cp : "");
67            if (cp)
68                *--cp = '/';
69
70            if (access (epath, R_OK) != NOTOK)
71                return epath;   /* else fall */
72try_it:
73#endif /* MHRC */
74
75        default:
76            /* Check nmh Mail directory */
77            if (access ((cp = m_mailpath (file)), R_OK) != NOTOK)
78                return cp;
79    }
80
81    /* Check nmh `etc' directory */
82    snprintf (epath, sizeof(epath), nmhetcdir(/%s), file);
83    return (access (epath, R_OK) != NOTOK ? epath : file);
84}
85
86
87/*
88 * Standard yes/no switches structure
89 */
90
91struct swit anoyes[] = {
92    { "no", 0 },
93    { "yes", 0 },
94    { NULL, 0 }
95};
96
97/*
98 * nmh constants
99 */
100
101/* initial profile for new users */
102char *mh_defaults = nmhetcdir (/mh.profile);
103
104/* default name of user profile */
105char *mh_profile = ".mh_profile";
106
107/* name of current message "sequence" */
108char *current = "cur";
109
110/* standard component files */
111char *components = "components";                /* comp         */
112char *replcomps = "replcomps";                  /* repl         */
113char *replgroupcomps = "replgroupcomps";        /* repl -group  */
114char *forwcomps = "forwcomps";                  /* forw         */
115char *distcomps = "distcomps";                  /* dist         */
116char *rcvdistcomps = "rcvdistcomps";            /* rcvdist      */
117char *digestcomps = "digestcomps";              /* forw -digest */
118
119/* standard format (filter) files */
120char *mhlformat = "mhl.format";                 /* show         */
121char *mhlreply = "mhl.reply";                   /* repl -filter */
122char *mhlforward = "mhl.forward";               /* forw -filter */
123
124char *draft = "draft";
125
126char *inbox = "Inbox";
127char *defaultfolder = "inbox";
128
129char *pfolder = "Current-Folder";
130char *usequence = "Unseen-Sequence";
131char *psequence = "Previous-Sequence";
132char *nsequence = "Sequence-Negation";
133
134/* profile entries for storage locations */
135char *nmhstorage = "nmh-storage";
136char *nmhcache = "nmh-cache";
137char *nmhprivcache = "nmh-private-cache";
138
139/* profile entry for external ftp access command */
140char *nmhaccessftp = "nmh-access-ftp";
141
142char *mhlibdir = NMHLIBDIR;
143char *mhetcdir = NMHETCDIR;
144
145/*
146 * nmh not-so constants
147 */
148
149/*
150 * Default name for the nmh context file.
151 */
152char *context = "context";
153
154/*
155 * Default name of file for public sequences.  If NULL,
156 * then nmh will use private sequences by default, unless the
157 * user defines a value using the "mh-sequences" profile entry.
158 */
159#ifdef NOPUBLICSEQ
160char *mh_seq = NULL;
161#else
162char *mh_seq = ".mh_sequences";
163#endif
164
165/*
166 * nmh globals
167 */
168
169char ctxflags;          /* status of user's context   */
170char *invo_name;        /* command invocation name    */
171char *mypath;           /* user's $HOME               */
172char *defpath;          /* pathname of user's profile */
173char *ctxpath;          /* pathname of user's context */
174struct node *m_defs;    /* profile/context structure  */
175
176/*
177 * nmh processes
178 */
179
180/*
181 * This is the program to process MIME composition files
182 */
183char *buildmimeproc = nmhbindir (/mhbuild);
184/*
185 * This is the program to `cat' a file.
186 */
187char *catproc = "/bin/cat";
188
189/*
190 * mhl runs this program as a visual-end.
191 */
192
193char *faceproc = NULL;
194
195/*
196 * This program is usually called directly by users, but it is
197 * also invoked by the post program to process an "Fcc", or by
198 * comp/repl/forw/dist to refile a draft message.
199 */
200
201char *fileproc = nmhbindir (/refile);
202
203/*
204 * This program is called to incorporate messages into a folder.
205 */
206
207char *incproc = nmhbindir (/inc);
208
209/*
210 * When a user runs an nmh program for the first time, this program
211 * is called to create his nmh profile, and mail directory.
212 */
213
214char *installproc = nmhlibdir (/install-mh);
215
216/*
217 * This is the default program invoked by a "list" response
218 * at the "What now?" prompt.  It is also used by the draft
219 * folder facility in comp/dist/forw/repl to display the
220 * draft message.
221 */
222
223char *lproc = DEFAULT_PAGER;
224
225/*
226 * This is the path for the Bell equivalent mail program.
227 */
228
229char *mailproc = nmhbindir (/mhmail);
230
231/*
232 * This is used by mhl as a front-end.  It is also used
233 * by mhn as the default method of displaying message bodies
234 * or message parts of type text/plain.
235 */
236
237char *moreproc = DEFAULT_PAGER;
238
239/*
240 * This is the program (mhl) used to filter messages.  It is
241 * used by mhn to filter and display the message headers of
242 * MIME messages.  It is used by repl/forw (with -filter)
243 * to filter the message to which you are replying/forwarding.
244 * It is used by send/post (with -filter) to filter the message
245 * for "Bcc:" recipients.
246 */
247
248char *mhlproc = nmhlibdir (/mhl);
249
250/*
251 * This is the super handy BBoard reading program, which is
252 * really just the nmh shell program.
253 */
254
255char *mshproc = nmhbindir (/msh);
256
257/*
258 * This program is called to pack a folder. 
259 */
260
261char *packproc = nmhbindir (/packf);
262
263/*
264 * This is the delivery program called by send to actually
265 * deliver mail to users.  This is the interface to the MTS.
266 */
267
268char *postproc = nmhlibdir (/spost);
269
270/*
271 * This is program is called by slocal to handle
272 * the action `folder' or `+'.
273 */
274
275char *rcvstoreproc = nmhlibdir (/rcvstore);
276
277/*
278 * This program is called to remove a folder. 
279 */
280
281char *rmfproc = nmhbindir (/rmf);
282
283/*
284 * This program is called to remove a message by rmm or refile -nolink.
285 * It's usually empty, which means to rename the file to a backup name.
286 */
287
288char *rmmproc = NULL;
289
290/*
291 * This program is usually called by the user's whatnowproc, but it
292 * may also be called directly to send a message previously composed.
293 */
294
295char *sendproc = nmhbindir (/send);
296
297/*
298 * This is the path to the program used by "show"
299 * to display non-text (MIME) messages.
300 */
301
302char *showmimeproc = nmhbindir (/mhshow);
303
304/*
305 * This is the default program called by "show" to filter
306 * and display standard text (non-MIME) messages.  It can be
307 * changed to a pager (such as "more" or "less") if you prefer
308 * that such message not be filtered in any way.
309 */
310
311char *showproc = DEFAULT_PAGER;
312
313/*
314 * This program is called by vmh as the back-end to the window management
315 * protocol
316 */
317
318char *vmhproc = nmhbindir (/msh);
319
320/*
321 * This program is called after comp, et. al., have built a draft
322 */
323
324char *whatnowproc = nmhbindir (/whatnow);
325
326/*
327 * This program is called to list/validate the addresses in a message.
328 */
329
330char *whomproc = nmhbindir (/whom);
331
332/*
333 * This is the editor invoked by the various message
334 * composition programs.  It SHOULD be a full screen
335 * editor, such as vi or emacs, but any editor will work.
336 */
337
338char *defaulteditor = DEFAULT_EDITOR;
339
340/*
341 * This is the global nmh alias file.  It is somewhat obsolete, since
342 * global aliases should be handled by the Mail Transport Agent (MTA).
343 */
344
345char *AliasFile = nmhetcdir (/MailAliases);
346
347/*
348 * File protections
349 */
350
351/*
352 * Folders (directories) are created with this protection (mode)
353 */
354
355char *foldprot = DEFAULT_FOLDER_MODE;
356
357/*
358 * Every NEW message will be created with this protection.  When a
359 * message is filed it retains its protection, so this only applies
360 * to messages coming in through inc.
361 */
362
363char *msgprot = DEFAULT_MESSAGE_MODE;
364
Note: See TracBrowser for help on using the repository browser.