summaryrefslogtreecommitdiff
path: root/src/shared/util.h
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-12-25 18:10:18 -0500
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-12-26 13:24:36 -0500
commite3e0314b56012f7febc279d268f2cadc1fcc0f25 (patch)
tree77167853e86557b2ec2e377ebdcebc91e1d13df4 /src/shared/util.h
parent8d5ba5a946388c965632713f6c1abfb3acba17f7 (diff)
systemctl: allow globbing in commands which take multiple unit names
Diffstat (limited to 'src/shared/util.h')
-rw-r--r--src/shared/util.h14
1 files changed, 11 insertions, 3 deletions
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);