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/m_maildir.h"
12 #define nmhbindir(file) NMHBINDIR#file
13 #define nmhlibexecdir(file) NMHLIBEXECDIR#file
14 #define nmhetcdir(file) NMHETCDIR#file
18 * Find the location of a format or configuration
19 * file, and return its absolute pathname.
21 * 1) If already absolute pathname, then leave unchanged.
22 * 2) Next, if it begins with ~user, then expand it.
23 * 3) Next, check in nmh Mail directory.
24 * 4) Next, check in nmh `etc' directory.
31 static char epath
[PATH_MAX
];
40 /* If already absolute pathname, return it */
44 /* Expand ~username */
45 if ((cp
= strchr(pp
= file
+ 1, '/')))
50 if ((pw
= getpwnam (pp
)))
59 snprintf (epath
, sizeof(epath
), "%s/%s", pp
, FENDNULL(cp
));
63 if (access (epath
, R_OK
) != NOTOK
)
69 /* Check nmh Mail directory */
70 if (access ((cp
= m_mailpath (file
)), R_OK
) != NOTOK
) {
71 /* Will leak because caller doesn't know cp was
72 dynamically allocated. */
78 /* Check nmh `etc' directory */
79 snprintf (epath
, sizeof(epath
), nmhetcdir(/%s
), file
);
80 return access(epath
, R_OK
) != NOTOK
? epath
: file
;
85 * Standard yes/no switches structure
88 struct swit anoyes
[] = {
98 /* initial profile for new users */
99 char *mh_defaults
= nmhetcdir (/mh
.profile
);
101 /* default name of user profile */
102 char *mh_profile
= ".mh_profile";
104 /* name of credentials file, defaults to .netrc in either Path or $HOME. */
105 char *credentials_file
;
107 /* if set to 1, do not check permissions on credentials file */
108 int credentials_no_perm_check
= 0;
110 /* name of current message "sequence" */
111 char *current
= "cur";
113 /* standard component files */
114 char *components
= "components"; /* comp */
115 char *replcomps
= "replcomps"; /* repl */
116 char *replgroupcomps
= "replgroupcomps"; /* repl -group */
117 char *forwcomps
= "forwcomps"; /* forw */
118 char *distcomps
= "distcomps"; /* dist */
119 char *rcvdistcomps
= "rcvdistcomps"; /* rcvdist */
120 char *digestcomps
= "digestcomps"; /* forw -digest */
122 /* standard format (filter) files */
123 char *mhlformat
= "mhl.format"; /* show */
124 char *mhlreply
= "mhl.reply"; /* repl -filter */
125 char *mhlforward
= "mhl.forward"; /* forw -filter */
127 char *draft
= "draft";
129 char *inbox
= "Inbox";
130 char *defaultfolder
= "inbox";
132 char *pfolder
= "Current-Folder";
133 char *usequence
= "Unseen-Sequence";
134 char *psequence
= "Previous-Sequence";
135 char *nsequence
= "Sequence-Negation";
137 /* profile entries for storage locations */
138 char *nmhstorage
= "nmh-storage";
139 char *nmhcache
= "nmh-cache";
140 char *nmhprivcache
= "nmh-private-cache";
142 /* profile entry for external ftp access command */
143 char *nmhaccessftp
= "nmh-access-ftp";
145 /* profile entry for external url access command */
146 char *nmhaccessurl
= "nmh-access-url";
148 char *mhbindir
= NMHBINDIR
;
149 char *mhlibexecdir
= NMHLIBEXECDIR
;
150 char *mhetcdir
= NMHETCDIR
;
151 char *mhdocdir
= NMHDOCDIR
;
154 * nmh not-so constants
158 * Default name for the nmh context file.
160 char *context
= "context";
163 * Default name of file for public sequences. If "\0" (an empty
164 * "mh-sequences" profile entry), then nmh will use private sequences by
167 char *mh_seq
= ".mh_sequences";
173 char ctxflags
; /* status of user's context */
174 char *invo_name
; /* command invocation name */
175 char *mypath
; /* user's $HOME */
176 char *defpath
; /* pathname of user's profile */
177 char *ctxpath
; /* pathname of user's context */
178 struct node
*m_defs
; /* profile/context structure */
185 * This is the program to process MIME composition files
187 char *buildmimeproc
= nmhbindir (/mhbuild
);
189 * This is the program to `cat' a file.
191 char *catproc
= "/bin/cat";
194 * This program is usually called directly by users, but it is
195 * also invoked by the post program to process an "Fcc", or by
196 * comp/repl/forw/dist to refile a draft message.
199 char *fileproc
= nmhbindir (/refile
);
202 * This program is used to optionally format the bodies of messages by
206 char *formatproc
= NULL
;
209 * This program is called to incorporate messages into a folder.
212 char *incproc
= nmhbindir (/inc
);
215 * This is the default program invoked by a "list" response
216 * at the "What now?" prompt. It is also used by the draft
217 * folder facility in comp/dist/forw/repl to display the
224 * This is the path for the Bell equivalent mail program.
227 char *mailproc
= nmhbindir (/mhmail
);
230 * This is used by mhl as a front-end. It is also used
231 * by mhn as the default method of displaying message bodies
232 * or message parts of type text/plain.
235 char *moreproc
= NULL
;
238 * This is the program (mhl) used to filter messages. It is
239 * used by mhn to filter and display the message headers of
240 * MIME messages. It is used by repl/forw (with -filter)
241 * to filter the message to which you are replying/forwarding.
242 * It is used by send/post (with -filter) to filter the message
243 * for "Bcc:" recipients.
246 char *mhlproc
= nmhlibexecdir (/mhl
);
249 * This program is called to pack a folder.
252 char *packproc
= nmhbindir (/packf
);
255 * This is the delivery program called by send to actually
256 * deliver mail to users. This is the interface to the MTS.
259 char *postproc
= nmhlibexecdir (/post
);
262 * This is program is called by slocal to handle
263 * the action `folder' or `+'.
266 char *rcvstoreproc
= nmhlibexecdir (/rcvstore
);
269 * This program is called to remove a message by rmm or refile -nolink.
270 * It's usually empty, which means to rename the file to a backup name.
273 char *rmmproc
= NULL
;
276 * This program is usually called by the user's whatnowproc, but it
277 * may also be called directly to send a message previously composed.
280 char *sendproc
= nmhbindir (/send
);
283 * This is the path to the program used by "show"
284 * to display non-text (MIME) messages.
287 char *showmimeproc
= nmhbindir (/mhshow
);
290 * This is the default program called by "show" to filter
291 * and display standard text (non-MIME) messages. It can be
292 * changed to a pager (such as "more" or "less") if you prefer
293 * that such message not be filtered in any way.
296 char *showproc
= nmhlibexecdir (/mhl
);
299 * This program is called after comp, et. al., have built a draft
302 char *whatnowproc
= nmhbindir (/whatnow
);
305 * This program is called to list/validate the addresses in a message.
308 char *whomproc
= nmhbindir (/whom
);
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).
315 char *AliasFile
= nmhetcdir (/MailAliases
);
322 * Folders (directories) are created with this protection (mode)
325 char *foldprot
= "700";
328 * Every NEW message will be created with this protection. When a
329 * message is filed it retains its protection, so this only applies
330 * to messages coming in through inc.
333 char *msgprot
= "600";