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.
16 #define nmhbindir(file) NMHBINDIR#file
17 #define nmhetcdir(file) NMHETCDIR#file
18 #define nmhlibdir(file) NMHLIBDIR#file
22 * Find the location of a format or configuration
23 * file, and return its absolute pathname.
25 * 1) If already absolute pathname, then leave unchanged.
26 * 2) Next, if it begins with ~user, then expand it.
27 * 3) Next, check in nmh Mail directory.
28 * 4) Next, check in nmh `etc' directory.
35 static char epath[PATH_MAX];
48 /* If already absolute pathname, return it */
53 /* Expand ~username */
54 if ((cp = strchr(pp = file + 1, '/')))
59 if ((pw = getpwnam (pp)))
68 snprintf (epath, sizeof(epath), "%s/%s", pp, cp ? cp : "");
72 if (access (epath, R_OK) != NOTOK)
73 return epath; /* else fall */
78 /* Check nmh Mail directory */
79 if (access ((cp = m_mailpath (file)), R_OK) != NOTOK)
83 /* Check nmh `etc' directory */
84 snprintf (epath, sizeof(epath), nmhetcdir(/%s), file);
85 return (access (epath, R_OK) != NOTOK ? epath : file);
90 * Standard yes/no switches structure
93 struct swit anoyes[] = {
103 /* initial profile for new users */
104 char *mh_defaults = nmhetcdir (/mh.profile);
106 /* default name of user profile */
107 char *mh_profile = ".mh_profile";
109 /* name of current message "sequence" */
110 char *current = "cur";
112 /* standard component files */
113 char *components = "components"; /* comp */
114 char *replcomps = "replcomps"; /* repl */
115 char *replgroupcomps = "replgroupcomps"; /* repl -group */
116 char *forwcomps = "forwcomps"; /* forw */
117 char *distcomps = "distcomps"; /* dist */
118 char *rcvdistcomps = "rcvdistcomps"; /* rcvdist */
119 char *digestcomps = "digestcomps"; /* forw -digest */
121 /* standard format (filter) files */
122 char *mhlformat = "mhl.format"; /* show */
123 char *mhlreply = "mhl.reply"; /* repl -filter */
124 char *mhlforward = "mhl.forward"; /* forw -filter */
126 char *draft = "draft";
128 char *inbox = "Inbox";
129 char *defaultfolder = "inbox";
131 char *pfolder = "Current-Folder";
132 char *usequence = "Unseen-Sequence";
133 char *psequence = "Previous-Sequence";
134 char *nsequence = "Sequence-Negation";
136 /* profile entries for storage locations */
137 char *nmhstorage = "nmh-storage";
138 char *nmhcache = "nmh-cache";
139 char *nmhprivcache = "nmh-private-cache";
141 /* profile entry for external ftp access command */
142 char *nmhaccessftp = "nmh-access-ftp";
144 char *mhlibdir = NMHLIBDIR;
145 char *mhetcdir = NMHETCDIR;
148 * nmh not-so constants
152 * Default name for the nmh context file.
154 char *context = "context";
157 * Default name of file for public sequences. If NULL,
158 * then nmh will use private sequences by default, unless the
159 * user defines a value using the "mh-sequences" profile entry.
164 char *mh_seq = ".mh_sequences";
171 char ctxflags; /* status of user's context */
172 char *invo_name; /* command invocation name */
173 char *mypath; /* user's $HOME */
174 char *defpath; /* pathname of user's profile */
175 char *ctxpath; /* pathname of user's context */
176 struct node *m_defs; /* profile/context structure */
183 * This is the program to process MIME composition files
185 char *buildmimeproc = nmhbindir (/mhbuild);
187 * This is the program to `cat' a file.
189 char *catproc = "/bin/cat";
192 * mhl runs this program as a visual-end.
195 char *faceproc = NULL;
198 * This program is usually called directly by users, but it is
199 * also invoked by the post program to process an "Fcc", or by
200 * comp/repl/forw/dist to refile a draft message.
203 char *fileproc = nmhbindir (/refile);
206 * This program is called to incorporate messages into a folder.
209 char *incproc = nmhbindir (/inc);
212 * When a user runs an nmh program for the first time, this program
213 * is called to create his nmh profile, and mail directory.
216 char *installproc = nmhlibdir (/install-mh);
219 * This is the default program invoked by a "list" response
220 * at the "What now?" prompt. It is also used by the draft
221 * folder facility in comp/dist/forw/repl to display the
225 char *lproc = DEFAULT_PAGER;
228 * This is the path for the Bell equivalent mail program.
231 char *mailproc = nmhbindir (/mhmail);
234 * This is used by mhl as a front-end. It is also used
235 * by mhn as the default method of displaying message bodies
236 * or message parts of type text/plain.
239 char *moreproc = DEFAULT_PAGER;
242 * This is the program (mhl) used to filter messages. It is
243 * used by mhn to filter and display the message headers of
244 * MIME messages. It is used by repl/forw (with -filter)
245 * to filter the message to which you are replying/forwarding.
246 * It is used by send/post (with -filter) to filter the message
247 * for "Bcc:" recipients.
250 char *mhlproc = nmhlibdir (/mhl);
253 * This is the super handy BBoard reading program, which is
254 * really just the nmh shell program.
257 char *mshproc = nmhbindir (/msh);
260 * This program is called to pack a folder.
263 char *packproc = nmhbindir (/packf);
266 * This is the delivery program called by send to actually
267 * deliver mail to users. This is the interface to the MTS.
270 char *postproc = nmhlibdir (/post);
273 * This is program is called by slocal to handle
274 * the action `folder' or `+'.
277 char *rcvstoreproc = nmhlibdir (/rcvstore);
280 * This program is called to remove a folder.
283 char *rmfproc = nmhbindir (/rmf);
286 * This program is called to remove a message by rmm or refile -nolink.
287 * It's usually empty, which means to rename the file to a backup name.
290 char *rmmproc = NULL;
293 * This program is usually called by the user's whatnowproc, but it
294 * may also be called directly to send a message previously composed.
297 char *sendproc = nmhbindir (/send);
300 * This is the path to the program used by "show"
301 * to display non-text (MIME) messages.
304 char *showmimeproc = nmhbindir (/mhshow);
307 * This is the default program called by "show" to filter
308 * and display standard text (non-MIME) messages. It can be
309 * changed to a pager (such as "more" or "less") if you prefer
310 * that such message not be filtered in any way.
313 char *showproc = nmhlibdir (/mhl);
316 * This program is called by vmh as the back-end to the window management
320 char *vmhproc = nmhbindir (/msh);
323 * This program is called after comp, et. al., have built a draft
326 char *whatnowproc = nmhbindir (/whatnow);
329 * This program is called to list/validate the addresses in a message.
332 char *whomproc = nmhbindir (/whom);
335 * This is the editor invoked by the various message
336 * composition programs. It SHOULD be a full screen
337 * editor, such as vi or emacs, but any editor will work.
340 char *defaulteditor = DEFAULT_EDITOR;
343 * This is the global nmh alias file. It is somewhat obsolete, since
344 * global aliases should be handled by the Mail Transport Agent (MTA).
347 char *AliasFile = nmhetcdir (/MailAliases);
354 * Folders (directories) are created with this protection (mode)
357 char *foldprot = DEFAULT_FOLDER_MODE;
360 * Every NEW message will be created with this protection. When a
361 * message is filed it retains its protection, so this only applies
362 * to messages coming in through inc.
365 char *msgprot = DEFAULT_MESSAGE_MODE;