11e2b212298c109ea14973d86bd96e6dba467e6b
[mmh] / sbr / getfolder.c
1 /*
2  * getfolder.c -- get the current or default folder
3  *
4  * This code is Copyright (c) 2002, by the authors of nmh.  See the
5  * COPYRIGHT file in the root directory of the nmh distribution for
6  * complete copyright information.
7  */
8
9 #include <h/mh.h>
10
11
12 char *
13 getfolder(int wantcurrent)
14 {
15         register 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 }