From e3e0314b56012f7febc279d268f2cadc1fcc0f25 Mon Sep 17 00:00:00 2001 From: Zbigniew Jędrzejewski-Szmek Date: Wed, 25 Dec 2013 18:10:18 -0500 Subject: systemctl: allow globbing in commands which take multiple unit names --- src/shared/util.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/shared/util.h') diff --git a/src/shared/util.h b/src/shared/util.h index b37072f24a..f6d2cedd88 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -47,9 +47,10 @@ /* What is interpreted as whitespace? */ #define WHITESPACE " \t\n\r" -#define NEWLINE "\n\r" -#define QUOTES "\"\'" -#define COMMENTS "#;" +#define NEWLINE "\n\r" +#define QUOTES "\"\'" +#define COMMENTS "#;" +#define GLOB_CHARS "*?[" #define FORMAT_BYTES_MAX 8 @@ -627,6 +628,13 @@ bool path_is_safe(const char *p) _pure_; bool string_is_safe(const char *p) _pure_; bool string_has_cc(const char *p) _pure_; +/** + * Check if a string contains any glob patterns. + */ +_pure_ static inline bool string_is_glob(const char *p) { + return !!strpbrk(p, GLOB_CHARS); +} + void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size, int (*compar) (const void *, const void *, void *), void *arg); -- cgit v1.2.3-54-g00ecf