]>
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 nmhlibexecdir(file) NMHLIBEXECDIR#file
15 #define nmhetcdir(file) NMHETCDIR#file
16 #define nmhdocdir(file) NMHDOCDIR#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
];
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
, cp
? cp
: "");
65 if (access (epath
, R_OK
) != NOTOK
)
66 return epath
; /* else fall */
70 /* Check nmh Mail directory */
71 if (access ((cp
= m_mailpath (file
)), R_OK
) != NOTOK
) {
72 /* Will leak because caller doesn't know cp was
73 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 /* name of current message "sequence" */
110 char *current
= "cur";
112 /* standard component files */
113 char *components
= "components"; /* comp */
114 char *replcomps
= "replcomps"; /* repl */
115 char *replgroupcomps
= "replgroupcomps"; /* repl -group */
116 char *forwcomps
= "forwcomps"; /* forw */
117 char *distcomps
= "distcomps"; /* dist */
118 char *rcvdistcomps
= "rcvdistcomps"; /* rcvdist */
119 char *digestcomps
= "digestcomps"; /* forw -digest */
121 /* standard format (filter) files */
122 char *mhlformat
= "mhl.format"; /* show */
123 char *mhlreply
= "mhl.reply"; /* repl -filter */
124 char *mhlforward
= "mhl.forward"; /* forw -filter */
126 char *draft
= "draft";
128 char *inbox
= "Inbox";
129 char *defaultfolder
= "inbox";
131 char *pfolder
= "Current-Folder";
132 char *usequence
= "Unseen-Sequence";
133 char *psequence
= "Previous-Sequence";
134 char *nsequence
= "Sequence-Negation";
136 /* profile entries for storage locations */
137 char *nmhstorage
= "nmh-storage";
138 char *nmhcache
= "nmh-cache";
139 char *nmhprivcache
= "nmh-private-cache";
141 /* profile entry for external ftp access command */
142 char *nmhaccessftp
= "nmh-access-ftp";
144 /* profile entry for external url access command */
145 char *nmhaccessurl
= "nmh-access-url";
147 char *mhbindir
= NMHBINDIR
;
148 char *mhlibexecdir
= NMHLIBEXECDIR
;
149 char *mhetcdir
= NMHETCDIR
;
150 char *mhdocdir
= NMHDOCDIR
;
153 * nmh not-so constants
157 * Default name for the nmh context file.
159 char *context
= "context";
162 * Default name of file for public sequences. If "\0" (an empty
163 * "mh-sequences" profile entry), then nmh will use private sequences by
166 char *mh_seq
= ".mh_sequences";
172 char ctxflags
; /* status of user's context */
173 char *invo_name
; /* command invocation name */
174 char *mypath
; /* user's $HOME */
175 char *defpath
; /* pathname of user's profile */
176 char *ctxpath
; /* pathname of user's context */
177 struct node
*m_defs
; /* profile/context structure */
184 * This is the program to process MIME composition files
186 char *buildmimeproc
= nmhbindir (/mhbuild
);
188 * This is the program to `cat' a file.
190 char *catproc
= "/bin/cat";
193 * This program is usually called directly by users, but it is
194 * also invoked by the post program to process an "Fcc", or by
195 * comp/repl/forw/dist to refile a draft message.
198 char *fileproc
= nmhbindir (/refile
);
201 * This program is used to optionally format the bodies of messages by
205 char *formatproc
= NULL
;
208 * This program is called to incorporate messages into a folder.
211 char *incproc
= nmhbindir (/inc
);
214 * This is the default program invoked by a "list" response
215 * at the "What now?" prompt. It is also used by the draft
216 * folder facility in comp/dist/forw/repl to display the
223 * This is the path for the Bell equivalent mail program.
226 char *mailproc
= nmhbindir (/mhmail
);
229 * This is used by mhl as a front-end. It is also used
230 * by mhn as the default method of displaying message bodies
231 * or message parts of type text/plain.
234 char *moreproc
= NULL
;
237 * This is the program (mhl) used to filter messages. It is
238 * used by mhn to filter and display the message headers of
239 * MIME messages. It is used by repl/forw (with -filter)
240 * to filter the message to which you are replying/forwarding.
241 * It is used by send/post (with -filter) to filter the message
242 * for "Bcc:" recipients.
245 char *mhlproc
= nmhlibexecdir (/mhl
);
248 * This program is called to pack a folder.
251 char *packproc
= nmhbindir (/packf
);
254 * This is the delivery program called by send to actually
255 * deliver mail to users. This is the interface to the MTS.
258 char *postproc
= nmhlibexecdir (/post
);
261 * This is program is called by slocal to handle
262 * the action `folder' or `+'.
265 char *rcvstoreproc
= nmhlibexecdir (/rcvstore
);
268 * This program is called to remove a message by rmm or refile -nolink.
269 * It's usually empty, which means to rename the file to a backup name.
272 char *rmmproc
= NULL
;
275 * This program is usually called by the user's whatnowproc, but it
276 * may also be called directly to send a message previously composed.
279 char *sendproc
= nmhbindir (/send
);
282 * This is the path to the program used by "show"
283 * to display non-text (MIME) messages.
286 char *showmimeproc
= nmhbindir (/mhshow
);
289 * This is the default program called by "show" to filter
290 * and display standard text (non-MIME) messages. It can be
291 * changed to a pager (such as "more" or "less") if you prefer
292 * that such message not be filtered in any way.
295 char *showproc
= nmhlibexecdir (/mhl
);
298 * This program is called after comp, et. al., have built a draft
301 char *whatnowproc
= nmhbindir (/whatnow
);
304 * This program is called to list/validate the addresses in a message.
307 char *whomproc
= nmhbindir (/whom
);
310 * This is the global nmh alias file. It is somewhat obsolete, since
311 * 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)
324 char *foldprot
= "700";
327 * Every NEW message will be created with this protection. When a
328 * message is filed it retains its protection, so this only applies
329 * to messages coming in through inc.
332 char *msgprot
= "600";