X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=blobdiff_plain;f=src%2Fngircd%2Fmatch.c;h=162a4f28a7b35a352903d2b62e534b5365ef0ffc;hp=2748a3e4569e3fa5631ba82060a76afa6921f718;hb=2a7dd06ebd9cc72d45a6a4becdbef5213d7b7800;hpb=77f54693ef258b1fe65ee105fc026dfb2c6257dc diff --git a/src/ngircd/match.c b/src/ngircd/match.c index 2748a3e4..162a4f28 100644 --- a/src/ngircd/match.c +++ b/src/ngircd/match.c @@ -7,14 +7,14 @@ * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. - * - * Wildcard pattern matching */ - #include "portab.h" -static char UNUSED id[] = "$Id: match.c,v 1.4 2005/07/31 20:13:08 alex Exp $"; +/** + * @file + * Wildcard pattern matching + */ #include "imp.h" #include @@ -22,6 +22,8 @@ static char UNUSED id[] = "$Id: match.c,v 1.4 2005/07/31 20:13:08 alex Exp $"; #include "exp.h" #include "match.h" +#include "defines.h" +#include "tool.h" /* @@ -32,8 +34,8 @@ static char UNUSED id[] = "$Id: match.c,v 1.4 2005/07/31 20:13:08 alex Exp $"; */ -static int Matche PARAMS(( char *p, char *t )); -static int Matche_After_Star PARAMS(( char *p, char *t )); +static int Matche PARAMS(( const char *p, const char *t )); +static int Matche_After_Star PARAMS(( const char *p, const char *t )); #define MATCH_PATTERN 6 /* bad pattern */ @@ -45,7 +47,7 @@ static int Matche_After_Star PARAMS(( char *p, char *t )); GLOBAL bool -Match( char *Pattern, char *String ) +Match( const char *Pattern, const char *String ) { /* Pattern mit String vergleichen */ if( Matche( Pattern, String ) == MATCH_VALID ) return true; @@ -53,8 +55,18 @@ Match( char *Pattern, char *String ) } /* Match */ +GLOBAL bool +MatchCaseInsensitive(const char *pattern, const char *searchme) +{ + char haystack[COMMAND_LEN]; + + strlcpy(haystack, searchme, sizeof(haystack)); + return Match(pattern, ngt_LowerStr(haystack)); +} /* MatchCaseInsensitive */ + + static int -Matche( char *p, char *t ) +Matche( const char *p, const char *t ) { register char range_start, range_end; bool invert; @@ -201,7 +213,7 @@ Matche( char *p, char *t ) static int -Matche_After_Star( char *p, char *t ) +Matche_After_Star( const char *p, const char *t ) { register int nextp, match = 0;