1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * Inspire is copyright (C) 2002-2004 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 * ---------------------------------------------------
18 #include "inspircd_config.h"
20 #include "inspstring.h"
22 // Wed 27 Apr 2005 - Brain
23 // I've taken our our old wildcard routine -
24 // although comprehensive, it was topheavy and very
25 // slow, and ate masses of cpu when doing lots of
26 // comparisons. This is the 'de-facto' routine used
27 // by many, nobody really knows who wrote it first
28 // or what license its under, i've seen examples of it
29 // (unattributed to any author) all over the 'net.
30 // For now, we'll just consider this public domain.
32 int wildcmp(char *wild, char *string)
35 while ((*string) && (*wild != '*'))
37 if ((*wild != *string) && (*wild != '?'))
57 if ((*wild == *string) || (*wild == '?'))
78 // This wrapper function is required to convert both
79 // strings to 'scandanavian lowercase' and make copies
80 // of them to a safe location. It also ensures we don't
81 // bite off more than we can chew with the length of
84 bool match(const char* literal, const char* mask)
88 strlcpy(L,literal,10240);
89 strlcpy(M,mask,10240);