]>
diplodocus.org Git - nmh/blob - config/config.c
3 * config.c -- master nmh configuration file
5 * This code is Copyright (c) 2002, by the authors of nmh. See the
6 * COPYRIGHT file in the root directory of the nmh distribution for
7 * complete copyright information.
13 #define nmhbindir(file) NMHBINDIR#file
14 #define nmhetcdir(file) NMHETCDIR#file
15 #define nmhlibexecdir(file) NMHLIBEXECDIR#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.
32 static char epath
[PATH_MAX
];
41 /* If already absolute pathname, return it */
45 /* Expand ~username */
46 if ((cp
= strchr(pp
= file
+ 1, '/')))
51 if ((pw
= getpwnam (pp
)))
60 snprintf (epath
, sizeof(epath
), "%s/%s", pp
, cp
? cp
: "");
64 if (access (epath
, R_OK
) != NOTOK
)
65 return epath
; /* else fall */
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. */
79 /* Check nmh `etc' directory */
80 snprintf (epath
, sizeof(epath
), nmhetcdir(/%s
), file
);
81 return (access (epath
, R_OK
) != NOTOK
? epath
: file
);
86 * Standard yes/no switches structure
89 struct swit anoyes
[] = {
99 /* initial profile for new users */
100 char *mh_defaults
= nmhetcdir (/mh
.profile
);
102 /* default name of user profile */
103 char *mh_profile
= ".mh_profile";
105 /* name of credentials file, defaults to .netrc in either Path or $HOME. */
106 char *credentials_file
;
108 /* name of current message "sequence" */
109 char *current
= "cur";
111 /* standard component files */
112 char *components
= "components"; /* comp */
113 char *replcomps
= "replcomps"; /* repl */
114 char *replgroupcomps
= "replgroupcomps"; /* repl -group */
115 char *forwcomps
= "forwcomps"; /* forw */
116 char *distcomps
= "distcomps"; /* dist */
117 char *rcvdistcomps
= "rcvdistcomps"; /* rcvdist */
118 char *digestcomps
= "digestcomps"; /* forw -digest */
120 /* standard format (filter) files */
121 char *mhlformat
= "mhl.format"; /* show */
122 char *mhlreply
= "mhl.reply"; /* repl -filter */
123 char *mhlforward
= "mhl.forward"; /* forw -filter */
125 char *draft
= "draft";
127 char *inbox
= "Inbox";
128 char *defaultfolder
= "inbox";
130 char *pfolder
= "Current-Folder";
131 char *usequence
= "Unseen-Sequence";
132 char *psequence
= "Previous-Sequence";
133 char *nsequence
= "Sequence-Negation";
135 /* profile entries for storage locations */
136 char *nmhstorage
= "nmh-storage";
137 char *nmhcache
= "nmh-cache";
138 char *nmhprivcache
= "nmh-private-cache";
140 /* profile entry for external ftp access command */
141 char *nmhaccessftp
= "nmh-access-ftp";
143 /* profile entry for external url access command */
144 char *nmhaccessurl
= "nmh-access-url";
146 char *mhbindir
= NMHBINDIR
;
147 char *mhetcdir
= NMHETCDIR
;
148 char *mhlibexecdir
= NMHLIBEXECDIR
;
151 * nmh not-so constants
155 * Default name for the nmh context file.
157 char *context
= "context";
160 * Default name of file for public sequences. If "\0" (an empty
161 * "mh-sequences" profile entry), then nmh will use private sequences by
164 char *mh_seq
= ".mh_sequences";
170 char ctxflags
; /* status of user's context */
171 char *invo_name
; /* command invocation name */
172 char *mypath
; /* user's $HOME */
173 char *defpath
; /* pathname of user's profile */
174 char *ctxpath
; /* pathname of user's context */
175 struct node
*m_defs
; /* profile/context structure */
182 * This is the program to process MIME composition files
184 char *buildmimeproc
= nmhbindir (/mhbuild
);
186 * This is the program to `cat' a file.
188 char *catproc
= "/bin/cat";
191 * This program is usually called directly by users, but it is
192 * also invoked by the post program to process an "Fcc", or by
193 * comp/repl/forw/dist to refile a draft message.
196 char *fileproc
= nmhbindir (/refile
);
199 * This program is used to optionally format the bodies of messages by
203 char *formatproc
= NULL
;
206 * This program is called to incorporate messages into a folder.
209 char *incproc
= nmhbindir (/inc
);
212 * This is the default program invoked by a "list" response
213 * at the "What now?" prompt. It is also used by the draft
214 * folder facility in comp/dist/forw/repl to display the
221 * This is the path for the Bell equivalent mail program.
224 char *mailproc
= nmhbindir (/mhmail
);
227 * This is used by mhl as a front-end. It is also used
228 * by mhn as the default method of displaying message bodies
229 * or message parts of type text/plain.
232 char *moreproc
= NULL
;
235 * This is the program (mhl) used to filter messages. It is
236 * used by mhn to filter and display the message headers of
237 * MIME messages. It is used by repl/forw (with -filter)
238 * to filter the message to which you are replying/forwarding.
239 * It is used by send/post (with -filter) to filter the message
240 * for "Bcc:" recipients.
243 char *mhlproc
= nmhlibexecdir (/mhl
);
246 * This is the super handy BBoard reading program, which is
247 * really just the nmh shell program.
250 char *mshproc
= nmhbindir (/msh
);
253 * This program is called to pack a folder.
256 char *packproc
= nmhbindir (/packf
);
259 * This is the delivery program called by send to actually
260 * deliver mail to users. This is the interface to the MTS.
263 char *postproc
= nmhlibexecdir (/post
);
266 * This is program is called by slocal to handle
267 * the action `folder' or `+'.
270 char *rcvstoreproc
= nmhlibexecdir (/rcvstore
);
273 * This program is called to remove a message by rmm or refile -nolink.
274 * It's usually empty, which means to rename the file to a backup name.
277 char *rmmproc
= NULL
;
280 * This program is usually called by the user's whatnowproc, but it
281 * may also be called directly to send a message previously composed.
284 char *sendproc
= nmhbindir (/send
);
287 * This is the path to the program used by "show"
288 * to display non-text (MIME) messages.
291 char *showmimeproc
= nmhbindir (/mhshow
);
294 * This is the default program called by "show" to filter
295 * and display standard text (non-MIME) messages. It can be
296 * changed to a pager (such as "more" or "less") if you prefer
297 * that such message not be filtered in any way.
300 char *showproc
= nmhlibexecdir (/mhl
);
303 * This program is called by vmh as the back-end to the window management
307 char *vmhproc
= nmhbindir (/msh
);
310 * This program is called after comp, et. al., have built a draft
313 char *whatnowproc
= nmhbindir (/whatnow
);
316 * This program is called to list/validate the addresses in a message.
319 char *whomproc
= nmhbindir (/whom
);
322 * This is the global nmh alias file. It is somewhat obsolete, since
323 * global aliases should be handled by the Mail Transport Agent (MTA).
326 char *AliasFile
= nmhetcdir (/MailAliases
);
333 * Folders (directories) are created with this protection (mode)
336 char *foldprot
= "700";
339 * Every NEW message will be created with this protection. When a
340 * message is filed it retains its protection, so this only applies
341 * to messages coming in through inc.
344 char *msgprot
= "600";