]> diplodocus.org Git - nmh/blob - sbr/getfolder.c
forwsbr.c: Move interface declaration to own forwsbr.h.
[nmh] / sbr / getfolder.c
1 /* getfolder.c -- get the current or default folder
2 *
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.
6 */
7
8 #include <h/mh.h>
9
10
11 /* Does not return NULL. */
12 char *
13 getfolder(int wantcurrent)
14 {
15 char *folder;
16
17 /*
18 * If wantcurrent == 1, then try the current folder first
19 */
20 if (wantcurrent && (folder = context_find (pfolder)) && *folder != '\0')
21 return folder;
22
23 /*
24 * Else try the Inbox profile entry
25 */
26 if ((folder = context_find (inbox)) && *folder != '\0')
27 return folder;
28
29 /*
30 * Else return compile time default.
31 */
32 return defaultfolder;
33 }