]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/basic/glob-util.h
mkosi.prepare: do not install build dependencies with NO_BUILD
[thirdparty/systemd.git] / src / basic / glob-util.h
CommitLineData
db9ecf05 1/* SPDX-License-Identifier: LGPL-2.1-or-later */
7d50b32a
LP
2#pragma once
3
48d7c648 4#include <glob.h>
11c3a366 5#include <stdbool.h>
7d50b32a
LP
6
7#include "macro.h"
b11d6a7b 8#include "string-util.h"
7d50b32a 9
48d7c648
ZJS
10/* Note: this function modifies pglob to set various functions. */
11int safe_glob(const char *path, int flags, glob_t *pglob);
12
f52faaf9
LB
13/* Note: which match is returned depends on the implementation/system and not guaranteed to be stable */
14int glob_first(const char *path, char **ret_first);
15#define glob_exists(path) glob_first(path, NULL)
544e146b 16int glob_extend(char ***strv, const char *path, int flags);
7d50b32a 17
1e472a6c
ZJS
18int glob_non_glob_prefix(const char *path, char **ret);
19
7d50b32a
LP
20#define _cleanup_globfree_ _cleanup_(globfree)
21
22_pure_ static inline bool string_is_glob(const char *p) {
23 /* Check if a string contains any glob patterns. */
24 return !!strpbrk(p, GLOB_CHARS);
25}