]>
diplodocus.org Git - nmh/blob - config/config.c
3 * config.c -- master nmh configuration file
7 * This code is Copyright (c) 2002, by the authors of nmh. See the
8 * COPYRIGHT file in the root directory of the nmh distribution for
9 * complete copyright information.
18 #define nmhbindir(file) NMHBINDIR#file
19 #define nmhetcdir(file) NMHETCDIR#file
20 #define nmhlibdir(file) NMHLIBDIR#file
24 * Find the location of a format or configuration
25 * file, and return its absolute pathname.
27 * 1) If already absolute pathname, then leave unchanged.
28 * 2) Next, if it begins with ~user, then expand it.
29 * 3) Next, check in nmh Mail directory.
30 * 4) Next, check in nmh `etc' directory.
37 static char epath
[PATH_MAX
];
50 /* If already absolute pathname, return it */
55 /* Expand ~username */
56 if ((cp
= strchr(pp
= file
+ 1, '/')))
61 if ((pw
= getpwnam (pp
)))
70 snprintf (epath
, sizeof(epath
), "%s/%s", pp
, cp
? cp
: "");
74 if (access (epath
, R_OK
) != NOTOK
)
75 return epath
; /* else fall */
80 /* Check nmh Mail directory */
81 if (access ((cp
= m_mailpath (file
)), R_OK
) != NOTOK
)
85 /* Check nmh `etc' directory */
86 snprintf (epath
, sizeof(epath
), nmhetcdir(/%s
), file
);
87 return (access (epath
, R_OK
) != NOTOK
? epath
: file
);
92 * Standard yes/no switches structure
95 struct swit anoyes
[] = {
105 /* initial profile for new users */
106 char *mh_defaults
= nmhetcdir (/mh
.profile
);
108 /* default name of user profile */
109 char *mh_profile
= ".mh_profile";
111 /* name of current message "sequence" */
112 char *current
= "cur";
114 /* standard component files */
115 char *components
= "components"; /* comp */
116 char *replcomps
= "replcomps"; /* repl */
117 char *replgroupcomps
= "replgroupcomps"; /* repl -group */
118 char *forwcomps
= "forwcomps"; /* forw */
119 char *distcomps
= "distcomps"; /* dist */
120 char *rcvdistcomps
= "rcvdistcomps"; /* rcvdist */
121 char *digestcomps
= "digestcomps"; /* forw -digest */
123 /* standard format (filter) files */
124 char *mhlformat
= "mhl.format"; /* show */
125 char *mhlreply
= "mhl.reply"; /* repl -filter */
126 char *mhlforward
= "mhl.forward"; /* forw -filter */
128 char *draft
= "draft";
130 char *inbox
= "Inbox";
131 char *defaultfolder
= "inbox";
133 char *pfolder
= "Current-Folder";
134 char *usequence
= "Unseen-Sequence";
135 char *psequence
= "Previous-Sequence";
136 char *nsequence
= "Sequence-Negation";
138 /* profile entries for storage locations */
139 char *nmhstorage
= "nmh-storage";
140 char *nmhcache
= "nmh-cache";
141 char *nmhprivcache
= "nmh-private-cache";
143 /* profile entry for external ftp access command */
144 char *nmhaccessftp
= "nmh-access-ftp";
146 char *mhlibdir
= NMHLIBDIR
;
147 char *mhetcdir
= NMHETCDIR
;
150 * nmh not-so constants
154 * Default name for the nmh context file.
156 char *context
= "context";
159 * Default name of file for public sequences. If NULL,
160 * then nmh will use private sequences by default, unless the
161 * user defines a value using the "mh-sequences" profile entry.
166 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 * mhl runs this program as a visual-end.
197 char *faceproc
= NULL
;
200 * This program is usually called directly by users, but it is
201 * also invoked by the post program to process an "Fcc", or by
202 * comp/repl/forw/dist to refile a draft message.
205 char *fileproc
= nmhbindir (/refile
);
208 * This program is called to incorporate messages into a folder.
211 char *incproc
= nmhbindir (/inc
);
214 * When a user runs an nmh program for the first time, this program
215 * is called to create his nmh profile, and mail directory.
218 char *installproc
= nmhlibdir (/install
-mh
);
221 * This is the default program invoked by a "list" response
222 * at the "What now?" prompt. It is also used by the draft
223 * folder facility in comp/dist/forw/repl to display the
227 char *lproc
= DEFAULT_PAGER
;
230 * This is the path for the Bell equivalent mail program.
233 char *mailproc
= nmhbindir (/mhmail
);
236 * This is used by mhl as a front-end. It is also used
237 * by mhn as the default method of displaying message bodies
238 * or message parts of type text/plain.
241 char *moreproc
= DEFAULT_PAGER
;
244 * This is the program (mhl) used to filter messages. It is
245 * used by mhn to filter and display the message headers of
246 * MIME messages. It is used by repl/forw (with -filter)
247 * to filter the message to which you are replying/forwarding.
248 * It is used by send/post (with -filter) to filter the message
249 * for "Bcc:" recipients.
252 char *mhlproc
= nmhlibdir (/mhl
);
255 * This is the super handy BBoard reading program, which is
256 * really just the nmh shell program.
259 char *mshproc
= nmhbindir (/msh
);
262 * This program is called to pack a folder.
265 char *packproc
= nmhbindir (/packf
);
268 * This is the delivery program called by send to actually
269 * deliver mail to users. This is the interface to the MTS.
272 char *postproc
= nmhlibdir (/post
);
275 * This is program is called by slocal to handle
276 * the action `folder' or `+'.
279 char *rcvstoreproc
= nmhlibdir (/rcvstore
);
282 * This program is called to remove a folder.
285 char *rmfproc
= nmhbindir (/rmf
);
288 * This program is called to remove a message by rmm or refile -nolink.
289 * It's usually empty, which means to rename the file to a backup name.
292 char *rmmproc
= NULL
;
295 * This program is usually called by the user's whatnowproc, but it
296 * may also be called directly to send a message previously composed.
299 char *sendproc
= nmhbindir (/send
);
302 * This is the path to the program used by "show"
303 * to display non-text (MIME) messages.
306 char *showmimeproc
= nmhbindir (/mhshow
);
309 * This is the default program called by "show" to filter
310 * and display standard text (non-MIME) messages. It can be
311 * changed to a pager (such as "more" or "less") if you prefer
312 * that such message not be filtered in any way.
315 char *showproc
= nmhlibdir (/mhl
);
318 * This program is called by vmh as the back-end to the window management
322 char *vmhproc
= nmhbindir (/msh
);
325 * This program is called after comp, et. al., have built a draft
328 char *whatnowproc
= nmhbindir (/whatnow
);
331 * This program is called to list/validate the addresses in a message.
334 char *whomproc
= nmhbindir (/whom
);
337 * This is the editor invoked by the various message
338 * composition programs. It SHOULD be a full screen
339 * editor, such as vi or emacs, but any editor will work.
342 char *defaulteditor
= DEFAULT_EDITOR
;
345 * This is the global nmh alias file. It is somewhat obsolete, since
346 * global aliases should be handled by the Mail Transport Agent (MTA).
349 char *AliasFile
= nmhetcdir (/MailAliases
);
356 * Folders (directories) are created with this protection (mode)
359 char *foldprot
= DEFAULT_FOLDER_MODE
;
362 * Every NEW message will be created with this protection. When a
363 * message is filed it retains its protection, so this only applies
364 * to messages coming in through inc.
367 char *msgprot
= DEFAULT_MESSAGE_MODE
;