chiark / gitweb /
gpg agent lockup fix: Interrupt main loop when active_connections_value==0
[gnupg2.git] / common / mkdir_p.h
1 /* mkdir_p.h - Create a directory and any missing parents.
2  * Copyright (C) 2015 g10 Code GmbH
3  *
4  * This file is part of GnuPG.
5  *
6  * This file is free software; you can redistribute it and/or modify
7  * it under the terms of either
8  *
9  *   - the GNU Lesser General Public License as published by the Free
10  *     Software Foundation; either version 3 of the License, or (at
11  *     your option) any later version.
12  *
13  * or
14  *
15  *   - the GNU General Public License as published by the Free
16  *     Software Foundation; either version 2 of the License, or (at
17  *     your option) any later version.
18  *
19  * or both in parallel, as here.
20  *
21  * This file is distributed in the hope that it will be useful,
22  * but WITHOUT ANY WARRANTY; without even the implied warranty of
23  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24  * GNU General Public License for more details.
25  *
26  * You should have received a copy of the GNU General Public License
27  * along with this program; if not, see <https://www.gnu.org/licenses/>.
28  */
29
30 #ifndef MKDIR_P_H
31 #define MKDIR_P_H
32
33 #include "types.h"
34
35 /* Create a directory as well as any missing parents.
36
37    The arguments must be NULL termianted.  If DIRECTORY_COMPONENTS...
38    consists of two elements, "foo/bar" and "xyzzy", this function will
39    first try to create the directory "foo/bar" and then the directory
40    "foo/bar/xyzzy".  On success returns 0, otherwise an error code is
41    returned.  */
42 gpg_error_t gnupg_mkdir_p (const char *directory_component, ...) GPGRT_ATTR_SENTINEL(0);
43
44 /* Like mkdir_p, but DIRECTORY_COMPONENTS is a NULL terminated
45    array, e.g.:
46
47      char **dirs = { "foo", "bar", NULL };
48      amkdir_p (dirs);
49  */
50 gpg_error_t gnupg_amkdir_p (const char **directory_components);
51
52 #endif