blob: 4e7d35da1d3999441b63f4643f59895eba342215 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#ifndef CLEANPATH_CLEANPATH_H
#define CLEANPATH_CLEANPATH_H
#define CLEANPATH_VERSION "0.1.0"
#define CLEANPATH_FILTER_NONE -1
#define CLEANPATH_FILTER_EXACT 0
#define CLEANPATH_FILTER_LOOSE 1
#define CLEANPATH_FILTER_REGEX 2
#define CLEANPATH_PART_MAX 1024
#define CLEANPATH_VAR "PATH"
#define CLEANPATH_SEP ":"
struct CleanPath {
char *data; // Pointer to the path string
size_t data_len; // Length of the path string
char *sep; // Pointer to the separator used to split the data string
char *part[CLEANPATH_PART_MAX]; // Array of pointers to path elements
size_t part_nelem; // Total number of elements in part array
};
// Prototypes
struct CleanPath *cleanpath_init(const char *path, const char *sep);
void cleanpath_filter(struct CleanPath *path, unsigned mode, const char *pattern);
char *cleanpath_read(struct CleanPath *path);
void cleanpath_free(struct CleanPath *path);
#endif //CLEANPATH_CLEANPATH_H
|