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