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.
14 ** Find the location of a format or configuration
15 ** file, and return its absolute pathname.
17 ** 1) If already absolute pathname, then leave unchanged.
18 ** 2) Next, if it begins with ~user, then expand it.
19 ** 3) Next, check in nmh Mail directory.
20 ** 4) Next, check in nmh `etc' directory.
26 static char epath[PATH_MAX];
33 /* Expand ~username */
34 if ((cp = strchr(pp = file + 1, '/')))
39 if ((pw = getpwnam (pp)))
48 snprintf (epath, sizeof(epath), "%s/%s", pp, cp ? cp : "");
52 if (access (epath, R_OK) != NOTOK)
53 return epath; /* else fall */
58 /* If already absolute pathname, return it */
62 /* Check nmh Mail directory */
63 strncpy(epath, toabsdir(file), sizeof epath);
64 if (access (epath, R_OK) != NOTOK)
67 /* Check nmh `etc' directory */
68 snprintf (epath, sizeof(epath), NMHETCDIR"/%s", file);
69 return (access (epath, R_OK) != NOTOK ? epath : file);
74 ** Standard yes/no switches structure
77 struct swit anoyes[] = {
87 /* initial profile for new users */
88 char *mh_defaults = NMHETCDIR"/mh.profile";
90 /* default name of user profile */
91 char *mh_profile = ".mh_profile";
93 /* name of current message "sequence" */
94 char *current = "cur";
96 /* standard component files */
97 char *components = "components"; /* comp */
98 char *replcomps = "replcomps"; /* repl */
99 char *replgroupcomps = "replgroupcomps"; /* repl -group */
100 char *forwcomps = "forwcomps"; /* forw */
101 char *distcomps = "distcomps"; /* dist */
102 char *rcvdistcomps = "rcvdistcomps"; /* rcvdist */
103 char *digestcomps = "digestcomps"; /* forw -digest */
105 /* standard format (filter) files */
106 char *mhlformat = "mhl.format"; /* show */
107 char *mhlreply = "mhl.reply"; /* repl -filter */
108 char *mhlforward = "mhl.forward"; /* forw -filter */
110 char *draftfolder = "+drafts";
112 char *inbox = "Inbox";
113 char *defaultfolder = "+inbox";
115 char *curfolder = "Current-Folder";
116 char *usequence = "Unseen-Sequence";
117 char *psequence = "Previous-Sequence";
118 char *nsequence = "Sequence-Negation";
120 /* profile entries for storage locations */
121 char *nmhstorage = "nmh-storage";
122 char *nmhcache = "nmh-cache";
123 char *nmhprivcache = "nmh-private-cache";
125 /* profile entry for external ftp access command */
126 char *nmhaccessftp = "nmh-access-ftp";
128 char *mhlibdir = NMHLIBDIR;
129 char *mhetcdir = NMHETCDIR;
132 ** nmh not-so constants
136 ** Default name for the nmh context file.
138 char *context = "context";
141 ** Default name of file for public sequences. If NULL,
142 ** then nmh will use private sequences by default, unless the
143 ** user defines a value using the "mh-sequences" profile entry.
148 char *mh_seq = ".mh_sequences";
155 char ctxflags; /* status of user's context */
156 char *invo_name; /* command invocation name */
157 char *mypath; /* user's $HOME */
158 char *defpath; /* pathname of user's profile */
159 char *ctxpath; /* pathname of user's context */
160 struct node *m_defs; /* profile/context structure */
167 ** This is the program to process MIME composition files
169 char *buildmimeproc = NMHBINDIR"/mhbuild";
171 ** This is the program to `cat' a file.
173 char *catproc = "/bin/cat";
176 ** mhl runs this program as a visual-end.
178 char *faceproc = NULL;
181 ** This program is usually called directly by users, but it is
182 ** also invoked by the spost program to process an "Fcc", or by
183 ** comp/repl/forw/dist to refile a draft message.
185 char *fileproc = NMHBINDIR"/refile";
188 ** This program is called to incorporate messages into a folder.
190 char *incproc = NMHBINDIR"/inc";
193 ** When a user runs an nmh program for the first time, this program
194 ** is called to create his nmh profile, and mail directory.
196 char *installproc = NMHLIBDIR"/install-mh";
199 ** This is the default program invoked by a "list" response
200 ** at the "What now?" prompt. It is also used by the draft
201 ** folder facility in comp/dist/forw/repl to display the
204 char *lproc = "more";
207 ** This is the path for the Bell equivalent mail program.
209 char *mailproc = NMHBINDIR"/mhmail";
212 ** This is used by mhl as a front-end. It is also used
213 ** by mhshow as the default method of displaying message bodies
214 ** or message parts of type text/plain.
216 char *moreproc = "more";
219 ** This is the program (mhl) used to filter messages. It is
220 ** used by mhshow to filter and display the message headers of
221 ** MIME messages. It is used by repl/forw (with -filter)
222 ** to filter the message to which you are replying/forwarding.
223 ** It is used by send/spost (with -filter) to filter the message
224 ** for "Bcc:" recipients.
226 char *mhlproc = NMHLIBDIR"/mhl";
229 ** This program is called to pack a folder.
231 char *packproc = NMHBINDIR"/packf";
234 ** This is the delivery program called by send to actually
235 ** deliver mail to users. This is the interface to the MTS.
237 char *postproc = NMHLIBDIR"/spost";
240 ** This is program is called by slocal to handle
241 ** the action `folder' or `+'.
243 char *rcvstoreproc = NMHLIBDIR"/rcvstore";
246 ** This program is called to remove a folder.
248 char *rmfproc = NMHBINDIR"/rmf";
251 ** This program is called to remove a message by rmm or refile -nolink.
252 ** It's usually empty, which means to rename the file to a backup name.
254 char *rmmproc = NULL;
257 ** This program is usually called by the user's whatnowproc, but it
258 ** may also be called directly to send a message previously composed.
260 char *sendproc = NMHBINDIR"/send";
263 ** This is the path to the program used by "show"
264 ** to display non-text (MIME) messages.
266 char *showmimeproc = NMHBINDIR"/mhshow";
269 ** This is the default program called by "show" to filter
270 ** and display standard text (non-MIME) messages. It can be
271 ** changed to a pager (such as "more" or "less") if you prefer
272 ** that such message not be filtered in any way.
274 char *showproc = NMHLIBDIR"/mhl";
277 ** This program is called after comp, et. al., have built a draft
279 char *whatnowproc = NMHBINDIR"/whatnow";
282 ** This is the sendmail interface to use for sending mail.
284 char *sendmail = SENDMAILPATH;
287 ** The prefix that is prepended to the name of message files when they
288 ** are "removed" by rmm. This should typically be `,' or `#'.
290 char *backup_prefix = ",";
293 ** This is the editor invoked by the various message
294 ** composition programs. It SHOULD be a full screen
295 ** editor, such as vi or emacs, but any editor will work.
297 char *defaulteditor = "vi";
300 ** Name of link to file to which you are replying or which you are
301 ** redistributing. See `$mhaltmsg' in the mh-profile(5) man page.
303 char *altmsglink = "@";
306 ** This is the global nmh alias file. It is somewhat obsolete, since
307 ** global aliases should be handled by the Mail Transport Agent (MTA).
309 char *AliasFile = NMHETCDIR"/MailAliases";
316 ** Folders (directories) are created with this protection (mode)
318 char *foldprot = "700";
321 ** Every NEW message will be created with this protection. When a
322 ** message is filed it retains its protection, so this only applies
323 ** to messages coming in through inc.
325 char *msgprot = "600";