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];
37 /* Expand ~username */
38 if ((cp = strchr(pp = file + 1, '/')))
43 if ((pw = getpwnam (pp)))
52 snprintf (epath, sizeof(epath), "%s/%s", pp, cp ? cp : "");
56 if (access (epath, R_OK) != NOTOK)
57 return epath; /* else fall */
63 /* If already absolute pathname, return it */
67 /* Check nmh Mail directory */
68 strncpy(epath, toabsdir(file), sizeof epath);
69 if (access (epath, R_OK) != NOTOK)
72 /* Check nmh `etc' directory */
73 snprintf (epath, sizeof(epath), NMHETCDIR"/%s", file);
74 return (access (epath, R_OK) != NOTOK ? epath : file);
79 ** Standard yes/no switches structure
82 struct swit anoyes[] = {
92 /* initial profile for new users */
93 char *mh_defaults = NMHETCDIR"/mh.profile";
95 /* default name of user profile */
96 char *mh_profile = ".mh_profile";
98 /* name of current message "sequence" */
99 char *current = "cur";
101 /* standard component files */
102 char *components = "components"; /* comp */
103 char *replcomps = "replcomps"; /* repl */
104 char *replgroupcomps = "replgroupcomps"; /* repl -group */
105 char *forwcomps = "forwcomps"; /* forw */
106 char *distcomps = "distcomps"; /* dist */
107 char *rcvdistcomps = "rcvdistcomps"; /* rcvdist */
108 char *digestcomps = "digestcomps"; /* forw -digest */
110 /* standard format (filter) files */
111 char *mhlformat = "mhl.format"; /* show */
112 char *mhlreply = "mhl.reply"; /* repl -filter */
113 char *mhlforward = "mhl.forward"; /* forw -filter */
115 char *draftfolder = "+drafts";
117 char *inbox = "Inbox";
118 char *defaultfolder = "+inbox";
120 char *pfolder = "Current-Folder";
121 char *usequence = "Unseen-Sequence";
122 char *psequence = "Previous-Sequence";
123 char *nsequence = "Sequence-Negation";
125 /* profile entries for storage locations */
126 char *nmhstorage = "nmh-storage";
127 char *nmhcache = "nmh-cache";
128 char *nmhprivcache = "nmh-private-cache";
130 /* profile entry for external ftp access command */
131 char *nmhaccessftp = "nmh-access-ftp";
133 char *mhlibdir = NMHLIBDIR;
134 char *mhetcdir = NMHETCDIR;
137 ** nmh not-so constants
141 ** Default name for the nmh context file.
143 char *context = "context";
146 ** Default name of file for public sequences. If NULL,
147 ** then nmh will use private sequences by default, unless the
148 ** user defines a value using the "mh-sequences" profile entry.
153 char *mh_seq = ".mh_sequences";
160 char ctxflags; /* status of user's context */
161 char *invo_name; /* command invocation name */
162 char *mypath; /* user's $HOME */
163 char *defpath; /* pathname of user's profile */
164 char *ctxpath; /* pathname of user's context */
165 struct node *m_defs; /* profile/context structure */
172 ** This is the program to process MIME composition files
174 char *buildmimeproc = NMHBINDIR"/mhbuild";
176 ** This is the program to `cat' a file.
178 char *catproc = "/bin/cat";
181 ** mhl runs this program as a visual-end.
183 char *faceproc = NULL;
186 ** This program is usually called directly by users, but it is
187 ** also invoked by the spost program to process an "Fcc", or by
188 ** comp/repl/forw/dist to refile a draft message.
190 char *fileproc = NMHBINDIR"/refile";
193 ** This program is called to incorporate messages into a folder.
195 char *incproc = NMHBINDIR"/inc";
198 ** When a user runs an nmh program for the first time, this program
199 ** is called to create his nmh profile, and mail directory.
201 char *installproc = NMHLIBDIR"/install-mh";
204 ** This is the default program invoked by a "list" response
205 ** at the "What now?" prompt. It is also used by the draft
206 ** folder facility in comp/dist/forw/repl to display the
209 char *lproc = "more";
212 ** This is the path for the Bell equivalent mail program.
214 char *mailproc = NMHBINDIR"/mhmail";
217 ** This is used by mhl as a front-end. It is also used
218 ** by mhshow as the default method of displaying message bodies
219 ** or message parts of type text/plain.
221 char *moreproc = "more";
224 ** This is the program (mhl) used to filter messages. It is
225 ** used by mhshow to filter and display the message headers of
226 ** MIME messages. It is used by repl/forw (with -filter)
227 ** to filter the message to which you are replying/forwarding.
228 ** It is used by send/spost (with -filter) to filter the message
229 ** for "Bcc:" recipients.
231 char *mhlproc = NMHLIBDIR"/mhl";
234 ** This program is called to pack a folder.
236 char *packproc = NMHBINDIR"/packf";
239 ** This is the delivery program called by send to actually
240 ** deliver mail to users. This is the interface to the MTS.
242 char *postproc = NMHLIBDIR"/spost";
245 ** This is program is called by slocal to handle
246 ** the action `folder' or `+'.
248 char *rcvstoreproc = NMHLIBDIR"/rcvstore";
251 ** This program is called to remove a folder.
253 char *rmfproc = NMHBINDIR"/rmf";
256 ** This program is called to remove a message by rmm or refile -nolink.
257 ** It's usually empty, which means to rename the file to a backup name.
259 char *rmmproc = NULL;
262 ** This program is usually called by the user's whatnowproc, but it
263 ** may also be called directly to send a message previously composed.
265 char *sendproc = NMHBINDIR"/send";
268 ** This is the path to the program used by "show"
269 ** to display non-text (MIME) messages.
271 char *showmimeproc = NMHBINDIR"/mhshow";
274 ** This is the default program called by "show" to filter
275 ** and display standard text (non-MIME) messages. It can be
276 ** changed to a pager (such as "more" or "less") if you prefer
277 ** that such message not be filtered in any way.
279 char *showproc = NMHLIBDIR"/mhl";
282 ** This program is called after comp, et. al., have built a draft
284 char *whatnowproc = NMHBINDIR"/whatnow";
287 ** This is the sendmail interface to use for sending mail.
289 char *sendmail = SENDMAILPATH;
292 ** The prefix that is prepended to the name of message files when they
293 ** are "removed" by rmm. This should typically be `,' or `#'.
295 char *backup_prefix = ",";
298 ** This is the editor invoked by the various message
299 ** composition programs. It SHOULD be a full screen
300 ** editor, such as vi or emacs, but any editor will work.
302 char *defaulteditor = "vi";
305 ** Name of link to file to which you are replying or which you are
306 ** redistributing. See `$mhaltmsg' in the mh-profile(5) man page.
308 char *altmsglink = "@";
311 ** This is the global nmh alias file. It is somewhat obsolete, since
312 ** global aliases should be handled by the Mail Transport Agent (MTA).
314 char *AliasFile = NMHETCDIR"/MailAliases";
321 ** Folders (directories) are created with this protection (mode)
323 char *foldprot = "700";
326 ** Every NEW message will be created with this protection. When a
327 ** message is filed it retains its protection, so this only applies
328 ** to messages coming in through inc.
330 char *msgprot = "600";