1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
20 #include "inspircd_config.h"
22 #include "helperfuncs.h"
23 #include "inspstring.h"
25 // Wed 27 Apr 2005 - Brain
26 // I've taken our our old wildcard routine -
27 // although comprehensive, it was topheavy and very
28 // slow, and ate masses of cpu when doing lots of
29 // comparisons. This is the 'de-facto' routine used
30 // by many, nobody really knows who wrote it first
31 // or what license its under, i've seen examples of it
32 // (unattributed to any author) all over the 'net.
33 // For now, we'll just consider this public domain.
35 int wildcmp(char *wild, char *string)
38 while ((*string) && (*wild != '*'))
40 if ((*wild != *string) && (*wild != '?'))
60 if ((*wild == *string) || (*wild == '?'))
81 // This wrapper function is required to convert both
82 // strings to 'scandanavian lowercase' and make copies
83 // of them to a safe location. It also ensures we don't
84 // bite off more than we can chew with the length of
87 bool match(const char* literal, const char* mask)
91 strlcpy(L,literal,10240);
92 strlcpy(M,mask,10240);