glob: add glob_first(), returns first match

Note that which match is returned depends on the system and is
not guaranteed to be stable
This commit is contained in:
Luca Boccassi
2022-08-23 20:04:41 +01:00
parent d4f38ff036
commit f52faaf923
3 changed files with 37 additions and 3 deletions
+3 -1
View File
@@ -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);