3 * config.c -- master nmh configuration file
14 #define nmhbindir(file) NMHBINDIR#file
15 #define nmhetcdir(file) NMHETCDIR#file
16 #define nmhlibdir(file) NMHLIBDIR#file
20 * Find the location of a format or configuration
21 * file, and return its absolute pathname.
23 * 1) If already absolute pathname, then leave unchanged.
24 * 2) Next, if it begins with ~user, then expand it.
25 * 3) Next, check in nmh Mail directory.
26 * 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.
193 char *faceproc = NULL;
196 * This program is usually called directly by users, but it is
197 * also invoked by the post program to process an "Fcc", or by
198 * comp/repl/forw/dist to refile a draft message.
201 char *fileproc = nmhbindir (/refile);
204 * This program is called to incorporate messages into a folder.
207 char *incproc = nmhbindir (/inc);
210 * When a user runs an nmh program for the first time, this program
211 * is called to create his nmh profile, and mail directory.
214 char *installproc = nmhlibdir (/install-mh);
217 * This is the default program invoked by a "list" response
218 * at the "What now?" prompt. It is also used by the draft
219 * folder facility in comp/dist/forw/repl to display the
223 char *lproc = DEFAULT_PAGER;
226 * This is the path for the Bell equivalent mail program.
229 char *mailproc = nmhbindir (/mhmail);
232 * This is used by mhl as a front-end. It is also used
233 * by mhn as the default method of displaying message bodies
234 * or message parts of type text/plain.
237 char *moreproc = DEFAULT_PAGER;
240 * This is the program (mhl) used to filter messages. It is
241 * used by mhn to filter and display the message headers of
242 * MIME messages. It is used by repl/forw (with -filter)
243 * to filter the message to which you are replying/forwarding.
244 * It is used by send/post (with -filter) to filter the message
245 * for "Bcc:" recipients.
248 char *mhlproc = nmhlibdir (/mhl);
251 * This is the super handy BBoard reading program, which is
252 * really just the nmh shell program.
255 char *mshproc = nmhbindir (/msh);
258 * This program is called to pack a folder.
261 char *packproc = nmhbindir (/packf);
264 * This is the delivery program called by send to actually
265 * deliver mail to users. This is the interface to the MTS.
268 char *postproc = nmhlibdir (/post);
271 * This is program is called by slocal to handle
272 * the action `folder' or `+'.
275 char *rcvstoreproc = nmhlibdir (/rcvstore);
278 * This program is called to remove a folder.
281 char *rmfproc = nmhbindir (/rmf);
284 * This program is called to remove a message by rmm or refile -nolink.
285 * It's usually empty, which means to rename the file to a backup name.
288 char *rmmproc = NULL;
291 * This program is usually called by the user's whatnowproc, but it
292 * may also be called directly to send a message previously composed.
295 char *sendproc = nmhbindir (/send);
298 * This is the path to the program used by "show"
299 * to display non-text (MIME) messages.
302 char *showmimeproc = nmhbindir (/mhshow);
305 * This is the default program called by "show" to filter
306 * and display standard text (non-MIME) messages. It can be
307 * changed to a pager (such as "more" or "less") if you prefer
308 * that such message not be filtered in any way.
311 char *showproc = nmhlibdir (/mhl);
314 * This program is called by vmh as the back-end to the window management
318 char *vmhproc = nmhbindir (/msh);
321 * This program is called after comp, et. al., have built a draft
324 char *whatnowproc = nmhbindir (/whatnow);
327 * This program is called to list/validate the addresses in a message.
330 char *whomproc = nmhbindir (/whom);
333 * This is the editor invoked by the various message
334 * composition programs. It SHOULD be a full screen
335 * editor, such as vi or emacs, but any editor will work.
338 char *defaulteditor = DEFAULT_EDITOR;
341 * This is the global nmh alias file. It is somewhat obsolete, since
342 * global aliases should be handled by the Mail Transport Agent (MTA).
345 char *AliasFile = nmhetcdir (/MailAliases);
352 * Folders (directories) are created with this protection (mode)
355 char *foldprot = DEFAULT_FOLDER_MODE;
358 * Every NEW message will be created with this protection. When a
359 * message is filed it retains its protection, so this only applies
360 * to messages coming in through inc.
363 char *msgprot = DEFAULT_MESSAGE_MODE;