summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/glob_pattern_p.cc
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2008-12-31 21:33:34 +0000
committerChristopher Faylor <me@cgf.cx>2008-12-31 21:33:34 +0000
commitecd5bc4ea8a158bd46e005dc4027c18d65a8106a (patch)
tree240f9a8dfe7cd88aa5e42355d91a6dc5d4f87d28 /winsup/cygwin/glob_pattern_p.cc
parent762cf3ee22b047d7eb0a06bf05a16dffab54cc53 (diff)
downloadcygnal-ecd5bc4ea8a158bd46e005dc4027c18d65a8106a.tar.gz
cygnal-ecd5bc4ea8a158bd46e005dc4027c18d65a8106a.tar.bz2
cygnal-ecd5bc4ea8a158bd46e005dc4027c18d65a8106a.zip
* glob_pattern_p.cc: New file.
* Makefile.in (DLL_OFILES): Add glob_pattern_p.o. * glob.h: Add declaration for glob_pattern_p. * pinfo.cc (pinfo::thisproc): Remove __stdcall attribute.
Diffstat (limited to 'winsup/cygwin/glob_pattern_p.cc')
-rw-r--r--winsup/cygwin/glob_pattern_p.cc28
1 files changed, 28 insertions, 0 deletions
diff --git a/winsup/cygwin/glob_pattern_p.cc b/winsup/cygwin/glob_pattern_p.cc
new file mode 100644
index 000000000..e8f42519b
--- /dev/null
+++ b/winsup/cygwin/glob_pattern_p.cc
@@ -0,0 +1,28 @@
+/* glob_pattern_p.c
+
+ int glob_pattern_p (__const char *__pattern, int __quote)
+
+ Return nonzero if PATTERN contains any metacharacters.
+ Metacharacters can be quoted with backslashes if QUOTE is nonzero.
+
+ This function is not part of the interface specified by POSIX.2
+ but several programs want to use it. */
+
+#include <string.h>
+
+extern "C" {
+
+int glob_pattern_p (const char *pattern, int quote)
+{
+ const char *quote_chars = "\\?*[]";
+ if (!quote)
+ quote_chars++;
+ while ((pattern = strpbrk (pattern, quote_chars)) != NULL)
+ if (*pattern == '\\')
+ pattern++;
+ else
+ return true;
+ return false;
+}
+
+} /* extern "C" */