summaryrefslogtreecommitdiff
path: root/src/wildcard.cpp
diff options
context:
space:
mode:
authorrburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864>2009-02-16 09:17:24 +0000
committerrburchell <rburchell@5417fbe8-f217-4b02-8779-1006273d7864>2009-02-16 09:17:24 +0000
commit010c774bc241f0c3a9c116988bfc3637cf64c5d7 (patch)
tree65a80fd39dadfa703a484799b338ea1518efbbbf /src/wildcard.cpp
parent22e8e87a00404725f32f4a53f57809d917876914 (diff)
Revert "Patch from DukePyrolator to replace all calls to match_wild() and match_wild_nocase() to use Anope::Match() instead. Also changes line-endings on wildcard.cpp to Unix-style, as well as fixes a small compile warning in language.c."
This reverts commit fcab9857f55567f10eaecbd6b26ee96f0f549d65. This isn't a simple sed operation, the order of arguments changed, so this would break everything using it. git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2081 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src/wildcard.cpp')
-rw-r--r--src/wildcard.cpp162
1 files changed, 81 insertions, 81 deletions
diff --git a/src/wildcard.cpp b/src/wildcard.cpp
index b66b8b29c..65916d038 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);
+}