ircproxy  The Ultimate Cyborg

IRC_compare.cc File Reference


Detailed Description

This file contains the implementation of IRCStringCompare.

Definition in file IRC_compare.cc.

#include "sys.h"
#include "IRC_compare.h"
#include "ircd_chattr.h"

Go to the source code of this file.

Functions

int IRCStringCompare (char const *s1, char const *s2)
 Compare two whole IRC strings in a 'case insensitive' way.
int IRCStringCompare (char const *s1, char const *s2, size_t count)
 Compare the first count characters of two IRC strings in a 'case insensitive' way.


Function Documentation

int IRCStringCompare ( char const *  s1,
char const *  s2 
)

Compare two whole IRC strings in a 'case insensitive' way.

Definition at line 25 of file IRC_compare.cc.

Referenced by ServerSession::detected_network(), ServerSession::found_network_name(), IRCStringCompare(), IRC_less::operator()(), and Identity::received_network_domain_answer().

00026 {
00027   while (ToLower(*s1) == ToLower(*s2))
00028   {
00029     if (!*s1++)
00030       return 0;
00031     else
00032       ++s2;
00033   }
00034   return static_cast<unsigned char>(ToLower(*s1)) - static_cast<unsigned char>(ToLower(*s2));
00035 }

int IRCStringCompare ( char const *  s1,
char const *  s2,
size_t  count 
)

Compare the first count characters of two IRC strings in a 'case insensitive' way.

Definition at line 37 of file IRC_compare.cc.

00038 {
00039   if (count == 0)
00040     return 0;
00041   while (--count != 0 && ToLower(*s1) == ToLower(*s2))
00042   {
00043     if (!*s1++)
00044       return 0;
00045     else
00046       ++s2;
00047   }
00048   return static_cast<unsigned char>(ToLower(*s1)) - static_cast<unsigned char>(ToLower(*s2));
00049 }


Copyright © 2005-2007 Carlo Wood.  All rights reserved.