diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2013-04-17 11:10:51 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2013-04-17 11:10:51 +0200 |
commit | 3d914eb90cd7aed1342a01c5993f8c2de4cd1283 (patch) | |
tree | 46046d3136b5ca4fd864813b36b62d330a9c9559 /runtime/srutils.c | |
parent | 39b35a32b4a45ccb6506e15b02780c30ca8c3973 (diff) | |
parent | 9d59080b4a43ca6d19bece357cb1132374a2116a (diff) | |
download | rsyslog-3d914eb90cd7aed1342a01c5993f8c2de4cd1283.tar.gz rsyslog-3d914eb90cd7aed1342a01c5993f8c2de4cd1283.tar.bz2 rsyslog-3d914eb90cd7aed1342a01c5993f8c2de4cd1283.zip |
Merge branch 'master' into master-imjournal
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 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: */ |