2 ** config.c -- master nmh configuration file
4 ** This code is Copyright (c) 2002, by the authors of nmh. See the
5 ** COPYRIGHT file in the root directory of the nmh distribution for
6 ** complete copyright information.
17 ** Find the location of a format or configuration
18 ** file, and return its absolute pathname.
20 ** 1) If already absolute pathname, then leave unchanged.
21 ** 2) Next, if it begins with ~user, then expand it.
22 ** 3) Next, check in nmh Mail directory.
23 ** 4) Next, check in nmh `etc' directory.
29 static char epath[PATH_MAX];
42 /* If already absolute pathname, return it */
47 /* Expand ~username */
48 if ((cp = strchr(pp = file + 1, '/')))
53 if ((pw = getpwnam (pp)))
62 snprintf (epath, sizeof(epath), "%s/%s", pp, cp ? cp : "");
66 if (access (epath, R_OK) != NOTOK)
67 return epath; /* else fall */
72 /* Check nmh Mail directory */
73 if (access ((cp = m_mailpath (file)), R_OK) != NOTOK)
77 /* Check nmh `etc' directory */
78 snprintf (epath, sizeof(epath), NMHETCDIR"/%s", file);
79 return (access (epath, R_OK) != NOTOK ? epath : file);
84 ** Standard yes/no switches structure
87 struct swit anoyes[] = {
97 /* initial profile for new users */
98 char *mh_defaults = NMHETCDIR"/mh.profile";
100 /* default name of user profile */
101 char *mh_profile = ".mh_profile";
103 /* name of current message "sequence" */
104 char *current = "cur";
106 /* standard component files */
107 char *components = "components"; /* comp */
108 char *replcomps = "replcomps"; /* repl */
109 char *replgroupcomps = "replgroupcomps"; /* repl -group */
110 char *forwcomps = "forwcomps"; /* forw */
111 char *distcomps = "distcomps"; /* dist */
112 char *rcvdistcomps = "rcvdistcomps"; /* rcvdist */
113 char *digestcomps = "digestcomps"; /* forw -digest */
115 /* standard format (filter) files */
116 char *mhlformat = "mhl.format"; /* show */
117 char *mhlreply = "mhl.reply"; /* repl -filter */
118 char *mhlforward = "mhl.forward"; /* forw -filter */
120 char *draftfolder = "drafts";
122 char *inbox = "Inbox";
123 char *defaultfolder = "inbox";
125 char *pfolder = "Current-Folder";
126 char *usequence = "Unseen-Sequence";
127 char *psequence = "Previous-Sequence";
128 char *nsequence = "Sequence-Negation";
130 /* profile entries for storage locations */
131 char *nmhstorage = "nmh-storage";
132 char *nmhcache = "nmh-cache";
133 char *nmhprivcache = "nmh-private-cache";
135 /* profile entry for external ftp access command */
136 char *nmhaccessftp = "nmh-access-ftp";
138 char *mhlibdir = NMHLIBDIR;
139 char *mhetcdir = NMHETCDIR;
142 ** nmh not-so constants
146 ** Default name for the nmh context file.
148 char *context = "context";
151 ** Default name of file for public sequences. If NULL,
152 ** then nmh will use private sequences by default, unless the
153 ** user defines a value using the "mh-sequences" profile entry.
158 char *mh_seq = ".mh_sequences";
165 char ctxflags; /* status of user's context */
166 char *invo_name; /* command invocation name */
167 char *mypath; /* user's $HOME */
168 char *defpath; /* pathname of user's profile */
169 char *ctxpath; /* pathname of user's context */
170 struct node *m_defs; /* profile/context structure */
177 ** This is the program to process MIME composition files
179 char *buildmimeproc = NMHBINDIR"/mhbuild";
181 ** This is the program to `cat' a file.
183 char *catproc = "/bin/cat";
186 ** mhl runs this program as a visual-end.
188 char *faceproc = NULL;
191 ** This program is usually called directly by users, but it is
192 ** also invoked by the spost program to process an "Fcc", or by
193 ** comp/repl/forw/dist to refile a draft message.
195 char *fileproc = NMHBINDIR"/refile";
198 ** This program is called to incorporate messages into a folder.
200 char *incproc = NMHBINDIR"/inc";
203 ** When a user runs an nmh program for the first time, this program
204 ** is called to create his nmh profile, and mail directory.
206 char *installproc = NMHLIBDIR"/install-mh";
209 ** This is the default program invoked by a "list" response
210 ** at the "What now?" prompt. It is also used by the draft
211 ** folder facility in comp/dist/forw/repl to display the
214 char *lproc = "more";
217 ** This is the path for the Bell equivalent mail program.
219 char *mailproc = NMHBINDIR"/mhmail";
222 ** This is used by mhl as a front-end. It is also used
223 ** by mhshow as the default method of displaying message bodies
224 ** or message parts of type text/plain.
226 char *moreproc = "more";
229 ** This is the program (mhl) used to filter messages. It is
230 ** used by mhshow to filter and display the message headers of
231 ** MIME messages. It is used by repl/forw (with -filter)
232 ** to filter the message to which you are replying/forwarding.
233 ** It is used by send/spost (with -filter) to filter the message
234 ** for "Bcc:" recipients.
236 char *mhlproc = NMHLIBDIR"/mhl";
239 ** This program is called to pack a folder.
241 char *packproc = NMHBINDIR"/packf";
244 ** This is the delivery program called by send to actually
245 ** deliver mail to users. This is the interface to the MTS.
247 char *postproc = NMHLIBDIR"/spost";
250 ** This is program is called by slocal to handle
251 ** the action `folder' or `+'.
253 char *rcvstoreproc = NMHLIBDIR"/rcvstore";
256 ** This program is called to remove a folder.
258 char *rmfproc = NMHBINDIR"/rmf";
261 ** This program is called to remove a message by rmm or refile -nolink.
262 ** It's usually empty, which means to rename the file to a backup name.
264 char *rmmproc = NULL;
267 ** This program is usually called by the user's whatnowproc, but it
268 ** may also be called directly to send a message previously composed.
270 char *sendproc = NMHBINDIR"/send";
273 ** This is the path to the program used by "show"
274 ** to display non-text (MIME) messages.
276 char *showmimeproc = NMHBINDIR"/mhshow";
279 ** This is the default program called by "show" to filter
280 ** and display standard text (non-MIME) messages. It can be
281 ** changed to a pager (such as "more" or "less") if you prefer
282 ** that such message not be filtered in any way.
284 char *showproc = NMHLIBDIR"/mhl";
287 ** This program is called after comp, et. al., have built a draft
289 char *whatnowproc = NMHBINDIR"/whatnow";
292 ** This is the sendmail interface to use for sending mail.
294 char *sendmail = SENDMAILPATH;
297 ** The prefix that is prepended to the name of message files when they
298 ** are "removed" by rmm. This should typically be `,' or `#'.
300 char *backup_prefix = ",";
303 ** This is the editor invoked by the various message
304 ** composition programs. It SHOULD be a full screen
305 ** editor, such as vi or emacs, but any editor will work.
307 char *defaulteditor = "vi";
310 ** Name of link to file to which you are replying or which you are
311 ** redistributing. See `$mhaltmsg' in the mh-profile(5) man page.
313 char *altmsglink = "@";
316 ** This is the global nmh alias file. It is somewhat obsolete, since
317 ** global aliases should be handled by the Mail Transport Agent (MTA).
319 char *AliasFile = NMHETCDIR"/MailAliases";
326 ** Folders (directories) are created with this protection (mode)
328 char *foldprot = "700";
331 ** Every NEW message will be created with this protection. When a
332 ** message is filed it retains its protection, so this only applies
333 ** to messages coming in through inc.
335 char *msgprot = "600";