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.
25 static char epath[PATH_MAX];
32 /* Expand ~username */
33 if ((cp = strchr(pp = file + 1, '/')))
38 if ((pw = getpwnam(pp)))
47 snprintf(epath, sizeof epath, "%s/%s", pp, cp ? cp : "");
51 if (access(epath, R_OK) != NOTOK)
52 return epath; /* else fall */
57 /* If already absolute pathname, return it */
61 /* Check nmh Mail directory */
62 strncpy(epath, toabsdir(file), sizeof epath);
63 if (access(epath, R_OK) != NOTOK)
66 /* Check nmh `etc' directory */
67 snprintf(epath, sizeof epath, NMHETCDIR"/%s", file);
68 return (access(epath, R_OK) != NOTOK ? epath : file);
73 ** Standard yes/no switches structure
76 struct swit anoyes[] = {
86 /* initial profile for new users */
87 char *mh_defaults = NMHETCDIR"/mh.profile";
89 /* default name of user profile */
90 char *mh_profile = ".mh_profile";
92 /* name of current message "sequence" */
93 char *current = "cur";
95 /* standard component files */
96 char *components = "components"; /* comp */
97 char *replcomps = "replcomps"; /* repl */
98 char *replgroupcomps = "replgroupcomps"; /* repl -group */
99 char *forwcomps = "forwcomps"; /* forw */
100 char *distcomps = "distcomps"; /* dist */
101 char *rcvdistcomps = "rcvdistcomps"; /* rcvdist */
102 char *digestcomps = "digestcomps"; /* forw -digest */
104 /* standard format (filter) files */
105 char *mhlformat = "mhl.format"; /* show */
106 char *mhlreply = "mhl.reply"; /* repl -filter */
107 char *mhlforward = "mhl.forward"; /* forw -filter */
109 char *draftfolder = "+drafts";
111 char *inbox = "Inbox";
112 char *defaultfolder = "+inbox";
114 char *curfolder = "Current-Folder";
115 char *usequence = "Unseen-Sequence";
116 char *psequence = "Previous-Sequence";
117 char *nsequence = "Sequence-Negation";
119 /* profile entries for storage locations */
120 char *nmhstorage = "nmh-storage";
121 char *nmhcache = "nmh-cache";
122 char *nmhprivcache = "nmh-private-cache";
124 /* profile entry for external ftp access command */
125 char *nmhaccessftp = "nmh-access-ftp";
127 char *mhlibdir = NMHLIBDIR;
128 char *mhetcdir = NMHETCDIR;
131 ** nmh not-so constants
135 ** Default name for the nmh context file.
137 char *context = "context";
140 ** Default name of file for public sequences. If NULL,
141 ** then nmh will use private sequences by default, unless the
142 ** user defines a value using the "mh-sequences" profile entry.
147 char *mh_seq = ".mh_sequences";
154 char ctxflags; /* status of user's context */
155 char *invo_name; /* command invocation name */
156 char *mypath; /* user's $HOME */
157 char *defpath; /* pathname of user's profile */
158 char *ctxpath; /* pathname of user's context */
159 struct node *m_defs; /* profile/context structure */
166 ** This is the program to process MIME composition files
168 char *buildmimeproc = NMHBINDIR"/mhbuild";
170 ** This is the program to `cat' a file.
172 char *catproc = "/bin/cat";
175 ** mhl runs this program as a visual-end.
177 char *faceproc = NULL;
180 ** This program is usually called directly by users, but it is
181 ** also invoked by the spost program to process an "Fcc", or by
182 ** comp/repl/forw/dist to refile a draft message.
184 char *fileproc = NMHBINDIR"/refile";
187 ** This program is called to incorporate messages into a folder.
189 char *incproc = NMHBINDIR"/inc";
192 ** When a user runs an nmh program for the first time, this program
193 ** is called to create his nmh profile, and mail directory.
195 char *installproc = NMHLIBDIR"/install-mh";
198 ** This is the default program invoked by a "list" response
199 ** at the "What now?" prompt. It is also used by the draft
200 ** folder facility in comp/dist/forw/repl to display the
203 char *lproc = "more";
206 ** This is the path for the Bell equivalent mail program.
208 char *mailproc = NMHBINDIR"/mhmail";
211 ** This is used by mhl as a front-end. It is also used
212 ** by mhshow as the default method of displaying message bodies
213 ** or message parts of type text/plain.
215 char *moreproc = "more";
218 ** This is the program (mhl) used to filter messages. It is
219 ** used by mhshow to filter and display the message headers of
220 ** MIME messages. It is used by repl/forw (with -filter)
221 ** to filter the message to which you are replying/forwarding.
222 ** It is used by send/spost (with -filter) to filter the message
223 ** for "Bcc:" recipients.
225 char *mhlproc = NMHLIBDIR"/mhl";
228 ** This program is called to pack a folder.
230 char *packproc = NMHBINDIR"/packf";
233 ** This is the delivery program called by send to actually
234 ** deliver mail to users. This is the interface to the MTS.
236 char *postproc = NMHLIBDIR"/spost";
239 ** This is program is called by slocal to handle
240 ** the action `folder' or `+'.
242 char *rcvstoreproc = NMHLIBDIR"/rcvstore";
245 ** This program is called to remove a folder.
247 char *rmfproc = NMHBINDIR"/rmf";
250 ** This program is called to remove a message by rmm or refile -nolink.
251 ** It's usually empty, which means to rename the file to a backup name.
253 char *rmmproc = NULL;
256 ** This program is usually called by the user's whatnowproc, but it
257 ** may also be called directly to send a message previously composed.
259 char *sendproc = NMHBINDIR"/send";
262 ** This is the path to the program used by "show"
263 ** to display non-text (MIME) messages.
265 char *showmimeproc = NMHBINDIR"/mhshow";
268 ** This is the default program called by "show" to filter
269 ** and display standard text (non-MIME) messages. It can be
270 ** changed to a pager (such as "more" or "less") if you prefer
271 ** that such message not be filtered in any way.
273 char *showproc = NMHLIBDIR"/mhl";
276 ** This program is called after comp, et. al., have built a draft
278 char *whatnowproc = NMHBINDIR"/whatnow";
281 ** This is the sendmail interface to use for sending mail.
283 char *sendmail = SENDMAILPATH;
286 ** The prefix that is prepended to the name of message files when they
287 ** are "removed" by rmm. This should typically be `,' or `#'.
289 char *backup_prefix = ",";
292 ** This is the editor invoked by the various message
293 ** composition programs. It SHOULD be a full screen
294 ** editor, such as vi or emacs, but any editor will work.
296 char *defaulteditor = "vi";
299 ** Name of link to file to which you are replying or which you are
300 ** redistributing. See `$mhaltmsg' in the mh-profile(5) man page.
302 char *altmsglink = "@";
305 ** This is the global nmh alias file. It is somewhat obsolete, since
306 ** global aliases should be handled by the Mail Transport Agent (MTA).
308 char *AliasFile = NMHETCDIR"/MailAliases";
315 ** Folders (directories) are created with this protection (mode)
317 char *foldprot = "700";
320 ** Every NEW message will be created with this protection. When a
321 ** message is filed it retains its protection, so this only applies
322 ** to messages coming in through inc.
324 char *msgprot = "600";