|
Message-Id: <1405588375-24435-1-git-send-email-glommer@cloudius-systems.com> Date: Thu, 17 Jul 2014 13:12:55 +0400 From: Glauber Costa <glommer@...udius-systems.com> To: musl@...ts.openwall.com Cc: Glauber Costa <glommer@...udius-systems.com> Subject: [PATCH] implement glibc's glob_pattern_p Currently, glob is implemented but glob_pattern_p is not. This function can trivially be implemented with existing glob machinery, since all it does is to tell whether or not the string contains special symbols. This is basically the same logic as is_literal, but with inverted return value. The value of the "quote" parameter should also be inverted, since the man page states that when the quote parameter is *non*-zero, then backslashes are ignored. is_literal ignores them when useesc is *zero*. --- src/regex/glob.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/regex/glob.c b/src/regex/glob.c index 6affee0..cc488b0 100644 --- a/src/regex/glob.c +++ b/src/regex/glob.c @@ -234,5 +234,11 @@ void globfree(glob_t *g) g->gl_pathv = NULL; } +int __glob_pattern_p(const char *pattern, int quote) +{ + return !is_literal(pattern, !quote); +} + LFS64(glob); LFS64(globfree); +weak_alias(__glob_pattern_p, glob_pattern_p); -- 1.9.3
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.