dpkg 1.21.11
path.h
Go to the documentation of this file.
1/*
2 * libdpkg - Debian packaging suite library routines
3 * path.h - path handling routines
4 *
5 * Copyright © 2008-2012, 2015 Guillem Jover <guillem@debian.org>
6 *
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.
11 *
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.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21#ifndef LIBDPKG_PATH_H
22#define LIBDPKG_PATH_H
23
24#include <sys/stat.h>
25
26#include <stddef.h>
27
28#include <dpkg/macros.h>
29
31
38size_t path_trim_slash_slashdot(char *path);
39const char *path_skip_slash_dotslash(const char *path);
40const char *path_basename(const char *path);
41char *path_quote_filename(char *dst, const char *src, size_t size);
42
43char *path_make_temp_template(const char *suffix);
44
45int secure_unlink_statted(const char *pathname, const struct stat *stab);
46int secure_unlink(const char *pathname);
47int secure_remove(const char *pathname);
48
49void path_remove_tree(const char *pathname);
50
54
55#endif /* LIBDPKG_PATH_H */
#define DPKG_BEGIN_DECLS
Definition: macros.h:86
#define DPKG_END_DECLS
Definition: macros.h:87
char * path_make_temp_template(const char *suffix)
Create a template for a temporary pathname.
Definition: path.c:103
const char * path_skip_slash_dotslash(const char *path)
Skip ‘/’ and ‘.
Definition: path.c:68
char * path_quote_filename(char *dst, const char *src, size_t size)
Escape characters in a pathname for safe locale printing.
Definition: path.c:132
int secure_unlink_statted(const char *pathname, const struct stat *stab)
Definition: path-remove.c:38
const char * path_basename(const char *path)
Return the last component of a pathname.
Definition: path.c:84
int secure_remove(const char *pathname)
Securely remove a pathname.
Definition: path-remove.c:85
void path_remove_tree(const char *pathname)
Remove a pathname and anything below it.
Definition: path-remove.c:118
size_t path_trim_slash_slashdot(char *path)
Trim ‘/’ and ‘/.
Definition: path.c:43
int secure_unlink(const char *pathname)
Securely unlink a pathname.
Definition: path-remove.c:65