3 * config.c -- master nmh configuration file
5 * This code is Copyright (c) 2002, by the authors of nmh. See the
6 * COPYRIGHT file in the root directory of the nmh distribution for
7 * complete copyright information.
17 #define nmhbindir(file) NMHBINDIR#file
18 #define nmhetcdir(file) NMHETCDIR#file
19 #define nmhlibdir(file) NMHLIBDIR#file
23 * Find the location of a format or configuration
24 * file, and return its absolute pathname.
26 * 1) If already absolute pathname, then leave unchanged.
27 * 2) Next, if it begins with ~user, then expand it.
28 * 3) Next, check in nmh Mail directory.
29 * 4) Next, check in nmh `etc' directory.
36 static char epath[PATH_MAX];
49 /* If already absolute pathname, return it */
54 /* Expand ~username */
55 if ((cp = strchr(pp = file + 1, '/')))
60 if ((pw = getpwnam (pp)))
69 snprintf (epath, sizeof(epath), "%s/%s", pp, cp ? cp : "");
73 if (access (epath, R_OK) != NOTOK)
74 return epath; /* else fall */
79 /* Check nmh Mail directory */
80 if (access ((cp = m_mailpath (file)), R_OK) != NOTOK)
84 /* Check nmh `etc' directory */
85 snprintf (epath, sizeof(epath), nmhetcdir(/%s), file);
86 return (access (epath, R_OK) != NOTOK ? epath : file);
91 * Standard yes/no switches structure
94 struct swit anoyes[] = {
104 /* initial profile for new users */
105 char *mh_defaults = nmhetcdir (/mh.profile);
107 /* default name of user profile */
108 char *mh_profile = ".mh_profile";
110 /* name of current message "sequence" */
111 char *current = "cur";
113 /* standard component files */
114 char *components = "components"; /* comp */
115 char *replcomps = "replcomps"; /* repl */
116 char *replgroupcomps = "replgroupcomps"; /* repl -group */
117 char *forwcomps = "forwcomps"; /* forw */
118 char *distcomps = "distcomps"; /* dist */
119 char *rcvdistcomps = "rcvdistcomps"; /* rcvdist */
120 char *digestcomps = "digestcomps"; /* forw -digest */
122 /* standard format (filter) files */
123 char *mhlformat = "mhl.format"; /* show */
124 char *mhlreply = "mhl.reply"; /* repl -filter */
125 char *mhlforward = "mhl.forward"; /* forw -filter */
127 char *draft = "draft";
129 char *inbox = "Inbox";
130 char *defaultfolder = "inbox";
132 char *pfolder = "Current-Folder";
133 char *usequence = "Unseen-Sequence";
134 char *psequence = "Previous-Sequence";
135 char *nsequence = "Sequence-Negation";
137 /* profile entries for storage locations */
138 char *nmhstorage = "nmh-storage";
139 char *nmhcache = "nmh-cache";
140 char *nmhprivcache = "nmh-private-cache";
142 /* profile entry for external ftp access command */
143 char *nmhaccessftp = "nmh-access-ftp";
145 char *mhlibdir = NMHLIBDIR;
146 char *mhetcdir = NMHETCDIR;
149 * nmh not-so constants
153 * Default name for the nmh context file.
155 char *context = "context";
158 * Default name of file for public sequences. If NULL,
159 * then nmh will use private sequences by default, unless the
160 * user defines a value using the "mh-sequences" profile entry.
165 char *mh_seq = ".mh_sequences";
172 char ctxflags; /* status of user's context */
173 char *invo_name; /* command invocation name */
174 char *mypath; /* user's $HOME */
175 char *defpath; /* pathname of user's profile */
176 char *ctxpath; /* pathname of user's context */
177 struct node *m_defs; /* profile/context structure */
184 * This is the program to process MIME composition files
186 char *buildmimeproc = nmhbindir (/mhbuild);
188 * This is the program to `cat' a file.
190 char *catproc = "/bin/cat";
193 * mhl runs this program as a visual-end.
196 char *faceproc = NULL;
199 * This program is usually called directly by users, but it is
200 * also invoked by the post program to process an "Fcc", or by
201 * comp/repl/forw/dist to refile a draft message.
204 char *fileproc = nmhbindir (/refile);
207 * This program is called to incorporate messages into a folder.
210 char *incproc = nmhbindir (/inc);
213 * When a user runs an nmh program for the first time, this program
214 * is called to create his nmh profile, and mail directory.
217 char *installproc = nmhlibdir (/install-mh);
220 * This is the default program invoked by a "list" response
221 * at the "What now?" prompt. It is also used by the draft
222 * folder facility in comp/dist/forw/repl to display the
226 char *lproc = DEFAULT_PAGER;
229 * This is the path for the Bell equivalent mail program.
232 char *mailproc = nmhbindir (/mhmail);
235 * This is used by mhl as a front-end. It is also used
236 * by mhn as the default method of displaying message bodies
237 * or message parts of type text/plain.
240 char *moreproc = DEFAULT_PAGER;
243 * This is the program (mhl) used to filter messages. It is
244 * used by mhn to filter and display the message headers of
245 * MIME messages. It is used by repl/forw (with -filter)
246 * to filter the message to which you are replying/forwarding.
247 * It is used by send/post (with -filter) to filter the message
248 * for "Bcc:" recipients.
251 char *mhlproc = nmhlibdir (/mhl);
254 * This is the super handy BBoard reading program, which is
255 * really just the nmh shell program.
258 char *mshproc = nmhbindir (/msh);
261 * This program is called to pack a folder.
264 char *packproc = nmhbindir (/packf);
267 * This is the delivery program called by send to actually
268 * deliver mail to users. This is the interface to the MTS.
271 char *postproc = nmhlibdir (/post);
274 * This is program is called by slocal to handle
275 * the action `folder' or `+'.
278 char *rcvstoreproc = nmhlibdir (/rcvstore);
281 * This program is called to remove a folder.
284 char *rmfproc = nmhbindir (/rmf);
287 * This program is called to remove a message by rmm or refile -nolink.
288 * It's usually empty, which means to rename the file to a backup name.
291 char *rmmproc = NULL;
294 * This program is usually called by the user's whatnowproc, but it
295 * may also be called directly to send a message previously composed.
298 char *sendproc = nmhbindir (/send);
301 * This is the path to the program used by "show"
302 * to display non-text (MIME) messages.
305 char *showmimeproc = nmhbindir (/mhshow);
308 * This is the default program called by "show" to filter
309 * and display standard text (non-MIME) messages. It can be
310 * changed to a pager (such as "more" or "less") if you prefer
311 * that such message not be filtered in any way.
314 char *showproc = nmhlibdir (/mhl);
317 * This program is called by vmh as the back-end to the window management
321 char *vmhproc = nmhbindir (/msh);
324 * This program is called after comp, et. al., have built a draft
327 char *whatnowproc = nmhbindir (/whatnow);
330 * This program is called to list/validate the addresses in a message.
333 char *whomproc = nmhbindir (/whom);
336 * This is the editor invoked by the various message
337 * composition programs. It SHOULD be a full screen
338 * editor, such as vi or emacs, but any editor will work.
341 char *defaulteditor = DEFAULT_EDITOR;
344 * This is the global nmh alias file. It is somewhat obsolete, since
345 * global aliases should be handled by the Mail Transport Agent (MTA).
348 char *AliasFile = nmhetcdir (/MailAliases);
355 * Folders (directories) are created with this protection (mode)
358 char *foldprot = DEFAULT_FOLDER_MODE;
361 * Every NEW message will be created with this protection. When a
362 * message is filed it retains its protection, so this only applies
363 * to messages coming in through inc.
366 char *msgprot = DEFAULT_MESSAGE_MODE;