1 /* config.c -- master nmh configuration file
3 * This code is Copyright (c) 2002, by the authors of nmh. See the
4 * COPYRIGHT file in the root directory of the nmh distribution for
5 * complete copyright information.
9 #include "sbr/context_read.h"
10 #include "sbr/m_maildir.h"
13 #define nmhbindir(file) NMHBINDIR#file
14 #define nmhlibexecdir(file) NMHLIBEXECDIR#file
15 #define nmhetcdir(file) NMHETCDIR#file
19 * Find the location of a format or configuration
20 * file, and return its absolute pathname.
22 * 1) If already absolute pathname, then leave unchanged.
23 * 2) Next, if it begins with ~user, then expand it.
24 * 3) Next, check in nmh Mail directory.
25 * 4) Next, check in nmh `etc' directory.
27 * Does not return NULL.
33 static char epath
[PATH_MAX
];
42 /* If already absolute pathname, return it */
46 /* Expand ~username */
47 if ((cp
= strchr(pp
= file
+ 1, '/')))
52 if ((pw
= getpwnam (pp
)))
61 snprintf (epath
, sizeof(epath
), "%s/%s", pp
, FENDNULL(cp
));
65 if (access (epath
, R_OK
) != NOTOK
)
71 /* Check nmh Mail directory */
72 if (access ((cp
= m_mailpath (file
)), R_OK
) != NOTOK
) {
73 /* Will leak because caller doesn't know cp was
74 dynamically allocated. */
80 /* Check nmh `etc' directory */
81 snprintf (epath
, sizeof(epath
), nmhetcdir(/%s
), file
);
82 return access(epath
, R_OK
) != NOTOK
? epath
: file
;
87 * Standard yes/no switches structure
90 struct swit anoyes
[] = {
100 /* initial profile for new users */
101 char *mh_defaults
= nmhetcdir (/mh
.profile
);
103 /* default name of user profile */
104 char *mh_profile
= ".mh_profile";
106 /* name of credentials file, defaults to .netrc in either Path or $HOME. */
107 char *credentials_file
;
109 /* if set to 1, do not check permissions on credentials file */
110 int credentials_no_perm_check
= 0;
112 /* name of current message "sequence" */
113 char *current
= "cur";
115 /* standard component files */
116 char *components
= "components"; /* comp */
117 char *replcomps
= "replcomps"; /* repl */
118 char *replgroupcomps
= "replgroupcomps"; /* repl -group */
119 char *forwcomps
= "forwcomps"; /* forw */
120 char *distcomps
= "distcomps"; /* dist */
121 char *rcvdistcomps
= "rcvdistcomps"; /* rcvdist */
122 char *digestcomps
= "digestcomps"; /* forw -digest */
124 /* standard format (filter) files */
125 char *mhlformat
= "mhl.format"; /* show */
126 char *mhlreply
= "mhl.reply"; /* repl -filter */
127 char *mhlforward
= "mhl.forward"; /* forw -filter */
129 char *draft
= "draft";
131 char *inbox
= "Inbox";
132 char *defaultfolder
= "inbox";
134 char *pfolder
= "Current-Folder";
135 char *usequence
= "Unseen-Sequence";
136 char *psequence
= "Previous-Sequence";
137 char *nsequence
= "Sequence-Negation";
139 /* profile entries for storage locations */
140 char *nmhstorage
= "nmh-storage";
141 char *nmhcache
= "nmh-cache";
142 char *nmhprivcache
= "nmh-private-cache";
144 /* profile entry for external ftp access command */
145 char *nmhaccessftp
= "nmh-access-ftp";
147 /* profile entry for external url access command */
148 char *nmhaccessurl
= "nmh-access-url";
150 char *mhbindir
= NMHBINDIR
;
151 char *mhlibexecdir
= NMHLIBEXECDIR
;
152 char *mhetcdir
= NMHETCDIR
;
153 char *mhdocdir
= NMHDOCDIR
;
156 * nmh not-so constants
160 * Default name for the nmh context file.
162 char *context
= "context";
165 * Default name of file for public sequences. If "\0" (an empty
166 * "mh-sequences" profile entry), then nmh will use private sequences by
169 char *mh_seq
= ".mh_sequences";
175 char ctxflags
; /* status of user's context */
176 char *invo_name
; /* command invocation name */
177 char *mypath
; /* user's $HOME */
178 char *defpath
; /* pathname of user's profile */
179 char *ctxpath
; /* pathname of user's context */
180 struct node
*m_defs
; /* profile/context structure */
187 * This is the program to process MIME composition files
189 char *buildmimeproc
= nmhbindir (/mhbuild
);
191 * This is the program to `cat' a file.
193 char *catproc
= "/bin/cat";
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 used to optionally format the bodies of messages by
208 char *formatproc
= NULL
;
211 * This program is called to incorporate messages into a folder.
214 char *incproc
= nmhbindir (/inc
);
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
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
= NULL
;
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
= nmhlibexecdir (/mhl
);
251 * This program is called to pack a folder.
254 char *packproc
= nmhbindir (/packf
);
257 * This is the delivery program called by send to actually
258 * deliver mail to users. This is the interface to the MTS.
261 char *postproc
= nmhlibexecdir (/post
);
264 * This is program is called by slocal to handle
265 * the action `folder' or `+'.
268 char *rcvstoreproc
= nmhlibexecdir (/rcvstore
);
271 * This program is called to remove a message by rmm or refile -nolink.
272 * It's usually empty, which means to rename the file to a backup name.
275 char *rmmproc
= NULL
;
278 * This program is usually called by the user's whatnowproc, but it
279 * may also be called directly to send a message previously composed.
282 char *sendproc
= nmhbindir (/send
);
285 * This is the path to the program used by "show"
286 * to display non-text (MIME) messages.
289 char *showmimeproc
= nmhbindir (/mhshow
);
292 * This is the default program called by "show" to filter
293 * and display standard text (non-MIME) messages. It can be
294 * changed to a pager (such as "more" or "less") if you prefer
295 * that such message not be filtered in any way.
298 char *showproc
= nmhlibexecdir (/mhl
);
301 * This program is called after comp, et. al., have built a draft
304 char *whatnowproc
= nmhbindir (/whatnow
);
307 * This program is called to list/validate the addresses in a message.
310 char *whomproc
= nmhbindir (/whom
);
313 * This is the global nmh alias file. It is somewhat obsolete, since
314 * global aliases should be handled by the Mail Transport Agent (MTA).
317 char *AliasFile
= nmhetcdir (/MailAliases
);
324 * Folders (directories) are created with this protection (mode)
327 char *foldprot
= "700";
330 * Every NEW message will be created with this protection. When a
331 * message is filed it retains its protection, so this only applies
332 * to messages coming in through inc.
335 char *msgprot
= "600";