summaryrefslogtreecommitdiffstats
path: root/runtime/srutils.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2013-03-22 09:33:33 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2013-03-22 09:33:33 +0100
commit223439934c20f38bc00ec5287124737932d33ddb (patch)
tree83f1b2b82271574ddd503ab1c43049b86817f839 /runtime/srutils.c
parent785e0c3c8b00614b6f780f902442025f4558a160 (diff)
parent906ed9df906fe3a52b042929130e6fc9a00b53a8 (diff)
downloadrsyslog-223439934c20f38bc00ec5287124737932d33ddb.tar.gz
rsyslog-223439934c20f38bc00ec5287124737932d33ddb.tar.bz2
rsyslog-223439934c20f38bc00ec5287124737932d33ddb.zip
Merge branch 'master' into master-gt
Conflicts: configure.ac runtime/rsyslog.h
Diffstat (limited to 'runtime/srutils.c')
-rw-r--r--runtime/srutils.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/runtime/srutils.c b/runtime/srutils.c
index 7b485b23..6a509b4a 100644
--- a/runtime/srutils.c
+++ b/runtime/srutils.c
@@ -630,6 +630,28 @@ finalize_it:
RETiRet;
}
+/* Returns 1 if the given string contains a non-escaped glob(3)
+ * wildcard character and 0 otherwise (or if the string is empty).
+ */
+int
+containsGlobWildcard(char *str)
+{
+ char *p;
+ if(!str) {
+ return 0;
+ }
+ /* From Linux Programmer's Guide:
+ * "A string is a wildcard pattern if it contains one of the characters '?', '*' or '['"
+ * "One can remove the special meaning of '?', '*' and '[' by preceding them by a backslash"
+ */
+ for(p = str; *p != '\0'; p++) {
+ if((*p == '?' || *p == '*' || *p == '[') &&
+ (p == str || *(p-1) != '\\')) {
+ return 1;
+ }
+ }
+ return 0;
+}
/* vim:set ai:
*/