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.
14 #define nmhbindir(file) NMHBINDIR#file
15 #define nmhetcdir(file) NMHETCDIR#file
16 #define nmhlibdir(file) NMHLIBDIR#file
20 * Find the location of a format or configuration
21 * file, and return its absolute pathname.
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.
33 static char epath[PATH_MAX];
42 /* If already absolute pathname, return it */
46 /* Expand ~username */
47 if ((cp = strchr(pp = file + 1, '/')))
52 if ((pw = getpwnam (pp)))
61 snprintf (epath, sizeof(epath), "%s/%s", pp, cp ? cp : "");
65 if (access (epath, R_OK) != NOTOK)
66 return epath; /* else fall */
70 /* Check nmh Mail directory */
71 if (access ((cp = m_mailpath (file)), R_OK) != NOTOK)
75 /* Check nmh `etc' directory */
76 snprintf (epath, sizeof(epath), nmhetcdir(/%s), file);
77 return (access (epath, R_OK) != NOTOK ? epath : file);
82 * Standard yes/no switches structure
85 struct swit anoyes[] = {
95 /* initial profile for new users */
96 char *mh_defaults = nmhetcdir (/mh.profile);
98 /* default name of user profile */
99 char *mh_profile = ".mh_profile";
101 /* name of current message "sequence" */
102 char *current = "cur";
104 /* standard component files */
105 char *components = "components"; /* comp */
106 char *replcomps = "replcomps"; /* repl */
107 char *replgroupcomps = "replgroupcomps"; /* repl -group */
108 char *forwcomps = "forwcomps"; /* forw */
109 char *distcomps = "distcomps"; /* dist */
110 char *rcvdistcomps = "rcvdistcomps"; /* rcvdist */
111 char *digestcomps = "digestcomps"; /* forw -digest */
113 /* standard format (filter) files */
114 char *mhlformat = "mhl.format"; /* show */
115 char *mhlreply = "mhl.reply"; /* repl -filter */
116 char *mhlforward = "mhl.forward"; /* forw -filter */
118 char *draft = "draft";
120 char *inbox = "Inbox";
121 char *defaultfolder = "inbox";
123 char *pfolder = "Current-Folder";
124 char *usequence = "Unseen-Sequence";
125 char *psequence = "Previous-Sequence";
126 char *nsequence = "Sequence-Negation";
128 /* profile entries for storage locations */
129 char *nmhstorage = "nmh-storage";
130 char *nmhcache = "nmh-cache";
131 char *nmhprivcache = "nmh-private-cache";
133 /* profile entry for external ftp access command */
134 char *nmhaccessftp = "nmh-access-ftp";
136 char *mhlibdir = NMHLIBDIR;
137 char *mhetcdir = NMHETCDIR;
140 * nmh not-so constants
144 * Default name for the nmh context file.
146 char *context = "context";
149 * Default name of file for public sequences. If NULL,
150 * then nmh will use private sequences by default, unless the
151 * user defines a value using the "mh-sequences" profile entry.
156 char *mh_seq = ".mh_sequences";
163 char ctxflags; /* status of user's context */
164 char *invo_name; /* command invocation name */
165 char *mypath; /* user's $HOME */
166 char *defpath; /* pathname of user's profile */
167 char *ctxpath; /* pathname of user's context */
168 struct node *m_defs; /* profile/context structure */
175 * This is the program to process MIME composition files
177 char *buildmimeproc = nmhbindir (/mhbuild);
179 * This is the program to `cat' a file.
181 char *catproc = "/bin/cat";
184 * mhl runs this program as a visual-end.
187 char *faceproc = NULL;
190 * This program is usually called directly by users, but it is
191 * also invoked by the post program to process an "Fcc", or by
192 * comp/repl/forw/dist to refile a draft message.
195 char *fileproc = nmhbindir (/refile);
198 * This program is used to optionally format the bodies of messages by
202 char *formatproc = NULL;
205 * This program is called to incorporate messages into a folder.
208 char *incproc = nmhbindir (/inc);
211 * When a user runs an nmh program for the first time, this program
212 * is called to create his nmh profile, and mail directory.
215 char *installproc = nmhlibdir (/install-mh);
218 * This is the default program invoked by a "list" response
219 * at the "What now?" prompt. It is also used by the draft
220 * folder facility in comp/dist/forw/repl to display the
224 char *lproc = DEFAULT_PAGER;
227 * This is the path for the Bell equivalent mail program.
230 char *mailproc = nmhbindir (/mhmail);
233 * This is used by mhl as a front-end. It is also used
234 * by mhn as the default method of displaying message bodies
235 * or message parts of type text/plain.
238 char *moreproc = DEFAULT_PAGER;
241 * This is the program (mhl) used to filter messages. It is
242 * used by mhn to filter and display the message headers of
243 * MIME messages. It is used by repl/forw (with -filter)
244 * to filter the message to which you are replying/forwarding.
245 * It is used by send/post (with -filter) to filter the message
246 * for "Bcc:" recipients.
249 char *mhlproc = nmhlibdir (/mhl);
252 * This is the super handy BBoard reading program, which is
253 * really just the nmh shell program.
256 char *mshproc = nmhbindir (/msh);
259 * This program is called to pack a folder.
262 char *packproc = nmhbindir (/packf);
265 * This is the delivery program called by send to actually
266 * deliver mail to users. This is the interface to the MTS.
269 char *postproc = nmhlibdir (/post);
272 * This is program is called by slocal to handle
273 * the action `folder' or `+'.
276 char *rcvstoreproc = nmhlibdir (/rcvstore);
279 * This program is called to remove a message by rmm or refile -nolink.
280 * It's usually empty, which means to rename the file to a backup name.
283 char *rmmproc = NULL;
286 * This program is usually called by the user's whatnowproc, but it
287 * may also be called directly to send a message previously composed.
290 char *sendproc = nmhbindir (/send);
293 * This is the path to the program used by "show"
294 * to display non-text (MIME) messages.
297 char *showmimeproc = nmhbindir (/mhshow);
300 * This is the default program called by "show" to filter
301 * and display standard text (non-MIME) messages. It can be
302 * changed to a pager (such as "more" or "less") if you prefer
303 * that such message not be filtered in any way.
306 char *showproc = nmhlibdir (/mhl);
309 * This program is called by vmh as the back-end to the window management
313 char *vmhproc = nmhbindir (/msh);
316 * This program is called after comp, et. al., have built a draft
319 char *whatnowproc = nmhbindir (/whatnow);
322 * This program is called to list/validate the addresses in a message.
325 char *whomproc = nmhbindir (/whom);
328 * This is the editor invoked by the various message
329 * composition programs. It SHOULD be a full screen
330 * editor, such as vi or emacs, but any editor will work.
333 char *defaulteditor = DEFAULT_EDITOR;
336 * This is the global nmh alias file. It is somewhat obsolete, since
337 * global aliases should be handled by the Mail Transport Agent (MTA).
340 char *AliasFile = nmhetcdir (/MailAliases);
347 * Folders (directories) are created with this protection (mode)
350 char *foldprot = "700";
353 * Every NEW message will be created with this protection. When a
354 * message is filed it retains its protection, so this only applies
355 * to messages coming in through inc.
358 char *msgprot = "600";