diff options
author | Michael Biebl <biebl@debian.org> | 2013-03-27 12:03:58 +0100 |
---|---|---|
committer | Michael Biebl <biebl@debian.org> | 2013-03-27 12:03:58 +0100 |
commit | d7c2f609d30d5e4d2c69dd2dc7305bd8ec5736ec (patch) | |
tree | ab4cde54583b0e1eb92fdafe0eb7282b7923daa9 /runtime/srutils.c | |
parent | 86831d7a4f485e19befa8cc500d17766798ad07c (diff) | |
download | rsyslog-upstream/7.3.9.tar.gz |
Imported Upstream version 7.3.9upstream/7.3.9
Diffstat (limited to 'runtime/srutils.c')
-rw-r--r-- | runtime/srutils.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/runtime/srutils.c b/runtime/srutils.c index 7b485b2..6a509b4 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: */ |