aboutsummaryrefslogtreecommitdiff
path: root/posix/glob_internal.h
diff options
context:
space:
mode:
Diffstat (limited to 'posix/glob_internal.h')
-rw-r--r--posix/glob_internal.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/posix/glob_internal.h b/posix/glob_internal.h
index 12c9366..d118b35 100644
--- a/posix/glob_internal.h
+++ b/posix/glob_internal.h
@@ -19,35 +19,43 @@
#ifndef GLOB_INTERNAL_H
# define GLOB_INTERNAL_H
+enum
+{
+ GLOBPAT_NONE = 0x0,
+ GLOBPAT_SPECIAL = 0x1,
+ GLOBPAT_BACKSLASH = 0x2,
+ GLOBPAT_BRACKET = 0x4
+};
+
static inline int
__glob_pattern_type (const char *pattern, int quote)
{
const char *p;
- int ret = 0;
+ int ret = GLOBPAT_NONE;
for (p = pattern; *p != '\0'; ++p)
switch (*p)
{
case '?':
case '*':
- return 1;
+ return GLOBPAT_SPECIAL;
case '\\':
if (quote)
{
if (p[1] != '\0')
++p;
- ret |= 2;
+ ret |= GLOBPAT_BACKSLASH;
}
break;
case '[':
- ret |= 4;
+ ret |= GLOBPAT_BRACKET;
break;
case ']':
if (ret & 4)
- return 1;
+ return GLOBPAT_SPECIAL;
break;
}