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.
15 #define nmhbindir(file) NMHBINDIR#file
16 #define nmhetcdir(file) NMHETCDIR#file
17 #define nmhlibdir(file) NMHLIBDIR#file
21 * Find the location of a format or configuration
22 * file, and return its absolute pathname.
24 * 1) If already absolute pathname, then leave unchanged.
25 * 2) Next, if it begins with ~user, then expand it.
26 * 3) Next, check in nmh Mail directory.
27 * 4) Next, check in nmh `etc' directory.
33 static char epath[PATH_MAX];
46 /* If already absolute pathname, return it */
51 /* Expand ~username */
52 if ((cp = strchr(pp = file + 1, '/')))
57 if ((pw = getpwnam (pp)))
66 snprintf (epath, sizeof(epath), "%s/%s", pp, cp ? cp : "");
70 if (access (epath, R_OK) != NOTOK)
71 return epath; /* else fall */
76 /* Check nmh Mail directory */
77 if (access ((cp = m_mailpath (file)), R_OK) != NOTOK)
81 /* Check nmh `etc' directory */
82 snprintf (epath, sizeof(epath), nmhetcdir(/%s), file);
83 return (access (epath, R_OK) != NOTOK ? epath : file);
88 * Standard yes/no switches structure
91 struct swit anoyes[] = {
101 /* initial profile for new users */
102 char *mh_defaults = nmhetcdir (/mh.profile);
104 /* default name of user profile */
105 char *mh_profile = ".mh_profile";
107 /* name of current message "sequence" */
108 char *current = "cur";
110 /* standard component files */
111 char *components = "components"; /* comp */
112 char *replcomps = "replcomps"; /* repl */
113 char *replgroupcomps = "replgroupcomps"; /* repl -group */
114 char *forwcomps = "forwcomps"; /* forw */
115 char *distcomps = "distcomps"; /* dist */
116 char *rcvdistcomps = "rcvdistcomps"; /* rcvdist */
117 char *digestcomps = "digestcomps"; /* forw -digest */
119 /* standard format (filter) files */
120 char *mhlformat = "mhl.format"; /* show */
121 char *mhlreply = "mhl.reply"; /* repl -filter */
122 char *mhlforward = "mhl.forward"; /* forw -filter */
124 char *draft = "draft";
126 char *inbox = "Inbox";
127 char *defaultfolder = "inbox";
129 char *pfolder = "Current-Folder";
130 char *usequence = "Unseen-Sequence";
131 char *psequence = "Previous-Sequence";
132 char *nsequence = "Sequence-Negation";
134 /* profile entries for storage locations */
135 char *nmhstorage = "nmh-storage";
136 char *nmhcache = "nmh-cache";
137 char *nmhprivcache = "nmh-private-cache";
139 /* profile entry for external ftp access command */
140 char *nmhaccessftp = "nmh-access-ftp";
142 char *mhlibdir = NMHLIBDIR;
143 char *mhetcdir = NMHETCDIR;
146 * nmh not-so constants
150 * Default name for the nmh context file.
152 char *context = "context";
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.
162 char *mh_seq = ".mh_sequences";
169 char ctxflags; /* status of user's context */
170 char *invo_name; /* command invocation name */
171 char *mypath; /* user's $HOME */
172 char *defpath; /* pathname of user's profile */
173 char *ctxpath; /* pathname of user's context */
174 struct node *m_defs; /* profile/context structure */
181 * This is the program to process MIME composition files
183 char *buildmimeproc = nmhbindir (/mhbuild);
185 * This is the program to `cat' a file.
187 char *catproc = "/bin/cat";
190 * mhl runs this program as a visual-end.
192 char *faceproc = NULL;
195 * This program is usually called directly by users, but it is
196 * also invoked by the spost program to process an "Fcc", or by
197 * comp/repl/forw/dist to refile a draft message.
199 char *fileproc = nmhbindir (/refile);
202 * This program is called to incorporate messages into a folder.
204 char *incproc = nmhbindir (/inc);
207 * When a user runs an nmh program for the first time, this program
208 * is called to create his nmh profile, and mail directory.
210 char *installproc = nmhlibdir (/install-mh);
213 * This is the default program invoked by a "list" response
214 * at the "What now?" prompt. It is also used by the draft
215 * folder facility in comp/dist/forw/repl to display the
218 char *lproc = "more";
221 * This is the path for the Bell equivalent mail program.
223 char *mailproc = nmhbindir (/mhmail);
226 * This is used by mhl as a front-end. It is also used
227 * by mhshow as the default method of displaying message bodies
228 * or message parts of type text/plain.
230 char *moreproc = "more";
233 * This is the program (mhl) used to filter messages. It is
234 * used by mhshow to filter and display the message headers of
235 * MIME messages. It is used by repl/forw (with -filter)
236 * to filter the message to which you are replying/forwarding.
237 * It is used by send/spost (with -filter) to filter the message
238 * for "Bcc:" recipients.
240 char *mhlproc = nmhlibdir (/mhl);
243 * This program is called to pack a folder.
245 char *packproc = nmhbindir (/packf);
248 * This is the delivery program called by send to actually
249 * deliver mail to users. This is the interface to the MTS.
251 char *postproc = nmhlibdir (/spost);
254 * This is program is called by slocal to handle
255 * the action `folder' or `+'.
257 char *rcvstoreproc = nmhlibdir (/rcvstore);
260 * This program is called to remove a folder.
262 char *rmfproc = nmhbindir (/rmf);
265 * This program is called to remove a message by rmm or refile -nolink.
266 * It's usually empty, which means to rename the file to a backup name.
268 char *rmmproc = NULL;
271 * This program is usually called by the user's whatnowproc, but it
272 * may also be called directly to send a message previously composed.
274 char *sendproc = nmhbindir (/send);
277 * This is the path to the program used by "show"
278 * to display non-text (MIME) messages.
280 char *showmimeproc = nmhbindir (/mhshow);
283 * This is the default program called by "show" to filter
284 * and display standard text (non-MIME) messages. It can be
285 * changed to a pager (such as "more" or "less") if you prefer
286 * that such message not be filtered in any way.
288 char *showproc = nmhlibdir (/mhl);
291 * This program is called after comp, et. al., have built a draft
293 char *whatnowproc = nmhbindir (/whatnow);
296 * This is the sendmail interface to use for sending mail.
298 char *sendmail = SENDMAILPATH;
301 * The prefix that is prepended to the name of message files when they
302 * are "removed" by rmm. This should typically be `,' or `#'.
304 char *backup_prefix = ",";
307 * This is the editor invoked by the various message
308 * composition programs. It SHOULD be a full screen
309 * editor, such as vi or emacs, but any editor will work.
311 char *defaulteditor = "vi";
314 * Name of link to file to which you are replying or which you are
315 * redistributing. See `$mhaltmsg' in the mh-profile(5) man page.
317 char *altmsglink = "@";
320 * This is the global nmh alias file. It is somewhat obsolete, since
321 * global aliases should be handled by the Mail Transport Agent (MTA).
323 char *AliasFile = nmhetcdir (/MailAliases);
330 * Folders (directories) are created with this protection (mode)
332 char *foldprot = "700";
335 * Every NEW message will be created with this protection. When a
336 * message is filed it retains its protection, so this only applies
337 * to messages coming in through inc.
339 char *msgprot = "600";