1 /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 #pragma once 3 4 #include <glob.h> 5 #include <stdbool.h> 6 7 #include "macro.h" 8 #include "string-util.h" 9 10 /* Note: this function modifies pglob to set various functions. */ 11 int safe_glob(const char *path, int flags, glob_t *pglob); 12 13 int glob_exists(const char *path); 14 int glob_extend(char ***strv, const char *path, int flags); 15 16 int glob_non_glob_prefix(const char *path, char **ret); 17 18 #define _cleanup_globfree_ _cleanup_(globfree) 19 string_is_glob(const char * p)20_pure_ static inline bool string_is_glob(const char *p) { 21 /* Check if a string contains any glob patterns. */ 22 return !!strpbrk(p, GLOB_CHARS); 23 } 24