diff options
author | Luca Boccassi <bluca@debian.org> | 2022-08-03 14:20:41 +0100 |
---|---|---|
committer | Luca Boccassi <bluca@debian.org> | 2022-08-23 20:04:41 +0100 |
commit | f52faaf923acfe6fe3f0955d1ad66840b13babfc (patch) | |
tree | 231492119bbb57956a9967841f99c6595333e649 /src/basic/glob-util.h | |
parent | d4f38ff036ce001081175292e87198ee4b19c364 (diff) | |
download | systemd-f52faaf923acfe6fe3f0955d1ad66840b13babfc.tar.gz |
glob: add glob_first(), returns first match
Note that which match is returned depends on the system and is
not guaranteed to be stable
Diffstat (limited to 'src/basic/glob-util.h')
-rw-r--r-- | src/basic/glob-util.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/basic/glob-util.h b/src/basic/glob-util.h index fc86e990dd..7ca26cc27f 100644 --- a/src/basic/glob-util.h +++ b/src/basic/glob-util.h @@ -10,7 +10,9 @@ /* Note: this function modifies pglob to set various functions. */ int safe_glob(const char *path, int flags, glob_t *pglob); -int glob_exists(const char *path); +/* Note: which match is returned depends on the implementation/system and not guaranteed to be stable */ +int glob_first(const char *path, char **ret_first); +#define glob_exists(path) glob_first(path, NULL) int glob_extend(char ***strv, const char *path, int flags); int glob_non_glob_prefix(const char *path, char **ret); |