summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsjaz <sjaz@5417fbe8-f217-4b02-8779-1006273d7864>2009-08-06 16:45:21 +0000
committersjaz <sjaz@5417fbe8-f217-4b02-8779-1006273d7864>2009-08-06 16:45:21 +0000
commitc72a70ffaf0fa488d33237dda3af43d821c7968f (patch)
tree7f001a21421ab9fd13b8b4ec94513c9416282e7c /src
parent05942ff9bc2cdf61b7e16043e22f98a95b62ed20 (diff)
dos2unix'd src/wildcard.cpp - Time to check for others!
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2422 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r--src/wildcard.cpp162
1 files changed, 81 insertions, 81 deletions
diff --git a/src/wildcard.cpp b/src/wildcard.cpp
index 65916d038..b66b8b29c 100644
--- a/src/wildcard.cpp
+++ b/src/wildcard.cpp
@@ -1,81 +1,81 @@
-#include "services.h"
-
-static bool match_internal(const unsigned char *str, const unsigned char *mask, bool case_sensitive)
-{
- unsigned char *cp = NULL, *mp = NULL;
- unsigned char* string = (unsigned char*)str;
- unsigned char* wild = (unsigned char*)mask;
-
- while ((*string) && (*wild != '*'))
- {
- if (case_sensitive)
- {
- if (*wild != *string && *wild != '?')
- return false;
- }
- else
- {
- if (tolower(*wild) != tolower(*string) && *wild != '?')
- return false;
- }
-
- wild++;
- string++;
- }
-
- while (*string)
- {
- if (*wild == '*')
- {
- if (!*++wild)
- {
- return 1;
- }
-
- mp = wild;
- cp = string+1;
- }
- else
- {
- if (case_sensitive)
- {
- if (*wild == *string || *wild == '?')
- {
- wild++;
- string++;
- }
- else
- {
- wild = mp;
- string = cp++;
- }
- }
- else
- {
- if (tolower(*wild) == tolower(*string) || *wild == '?')
- {
- wild++;
- string++;
- }
- else
- {
- wild = mp;
- string = cp++;
- }
- }
- }
-
- }
-
- while (*wild == '*')
- {
- wild++;
- }
-
- return !*wild;
-}
-
-CoreExport bool Anope::Match(const std::string &str, const std::string &mask, bool case_sensitive)
-{
- return match_internal((const unsigned char *)str.c_str(), (const unsigned char *)mask.c_str(), case_sensitive);
-}
+#include "services.h"
+
+static bool match_internal(const unsigned char *str, const unsigned char *mask, bool case_sensitive)
+{
+ unsigned char *cp = NULL, *mp = NULL;
+ unsigned char* string = (unsigned char*)str;
+ unsigned char* wild = (unsigned char*)mask;
+
+ while ((*string) && (*wild != '*'))
+ {
+ if (case_sensitive)
+ {
+ if (*wild != *string && *wild != '?')
+ return false;
+ }
+ else
+ {
+ if (tolower(*wild) != tolower(*string) && *wild != '?')
+ return false;
+ }
+
+ wild++;
+ string++;
+ }
+
+ while (*string)
+ {
+ if (*wild == '*')
+ {
+ if (!*++wild)
+ {
+ return 1;
+ }
+
+ mp = wild;
+ cp = string+1;
+ }
+ else
+ {
+ if (case_sensitive)
+ {
+ if (*wild == *string || *wild == '?')
+ {
+ wild++;
+ string++;
+ }
+ else
+ {
+ wild = mp;
+ string = cp++;
+ }
+ }
+ else
+ {
+ if (tolower(*wild) == tolower(*string) || *wild == '?')
+ {
+ wild++;
+ string++;
+ }
+ else
+ {
+ wild = mp;
+ string = cp++;
+ }
+ }
+ }
+
+ }
+
+ while (*wild == '*')
+ {
+ wild++;
+ }
+
+ return !*wild;
+}
+
+CoreExport bool Anope::Match(const std::string &str, const std::string &mask, bool case_sensitive)
+{
+ return match_internal((const unsigned char *)str.c_str(), (const unsigned char *)mask.c_str(), case_sensitive);
+}