po: Update German man pages translation
[dpkg.git] / lib / dpkg / treewalk.h
blob1e8202320ff769a5ceffd1cfd42bb4bd6e7ffb57
1 /*
2 * libdpkg - Debian packaging suite library routines
3 * treewalk.h - directory tree walk support
5 * Copyright © 2013-2015 Guillem Jover <guillem@debian.org>
7 * This is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #ifndef LIBDPKG_TREEWALK_H
22 #define LIBDPKG_TREEWALK_H
24 #include <dpkg/macros.h>
26 #include <sys/stat.h>
27 #include <sys/types.h>
29 #include <stdbool.h>
31 DPKG_BEGIN_DECLS
33 /**
34 * @defgroup treewalk Directory tree walking
35 * @ingroup dpkg-internal
36 * @{
39 enum treewalk_options {
40 TREEWALK_NONE = 0,
41 TREEWALK_FORCE_STAT = DPKG_BIT(0),
42 TREEWALK_FOLLOW_LINKS = DPKG_BIT(1),
45 struct treenode;
47 typedef int treenode_visit_func(struct treenode *node);
48 typedef bool treenode_skip_func(struct treenode *node);
49 typedef int treenode_sort_func(struct treenode *node);
51 struct treewalk_funcs {
52 treenode_visit_func *visit;
53 treenode_sort_func *sort;
54 treenode_skip_func *skip;
57 struct treeroot *
58 treewalk_open(const char *rootdir, enum treewalk_options options,
59 const struct treewalk_funcs *funcs);
60 struct treenode *
61 treewalk_node(struct treeroot *tree);
62 struct treenode *
63 treewalk_next(struct treeroot *tree);
64 void
65 treewalk_close(struct treeroot *tree);
67 int
68 treewalk(const char *rootdir, enum treewalk_options options,
69 struct treewalk_funcs *funcs);
71 struct treenode *
72 treenode_get_parent(struct treenode *node);
73 const char *
74 treenode_get_name(struct treenode *node);
75 const char *
76 treenode_get_pathname(struct treenode *node);
77 const char *
78 treenode_get_virtname(struct treenode *node);
79 mode_t
80 treenode_get_mode(struct treenode *node);
81 struct stat *
82 treenode_get_stat(struct treenode *node);
84 /** @} */
86 DPKG_END_DECLS
88 #endif /* LIBDPKG_TREEWALK_H */