From abb61af25f55a14fa2dc4779002720f538828c8c Mon Sep 17 00:00:00 2001 From: imaginos Date: Tue, 24 Aug 2004 22:53:37 +0000 Subject: [PATCH] source modifications to allow compilation on solaris git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@15 726aef4b-f618-498e-8847-2d620e286838 --- Csocket.h | 9 +++++++++ Utils.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/Csocket.h b/Csocket.h index 66050ab1..732ff4d9 100644 --- a/Csocket.h +++ b/Csocket.h @@ -51,6 +51,11 @@ #include #include +#ifdef __sun +#include +#include +#endif /* __sun */ + #ifdef HAVE_LIBSSL #include #include @@ -121,12 +126,16 @@ namespace Csocket inline void __Perror( const CS_STRING & s ) { +#ifdef __sun + CS_DEBUG( s << ": " << strerror( errno ) ); +#else char buff[512]; memset( (char *)buff, '\0', 512 ); if ( strerror_r( errno, buff, 511 ) == 0 ) CS_DEBUG( s << ": " << buff ); else CS_DEBUG( s << ": Unknown Error Occured" ); +#endif /* __sun */ } inline unsigned long long millitime() { diff --git a/Utils.cpp b/Utils.cpp index 8e60c431..86fc63c4 100644 --- a/Utils.cpp +++ b/Utils.cpp @@ -11,6 +11,30 @@ using std::stringstream; CUtils::CUtils() {} CUtils::~CUtils() {} +#ifdef __sun +char *strcasestr(const char *big, const char *little) +{ + int len; + + if (!little || !big || !little[0]) + return (char *) big; + + len = strlen(little); + while (*big) + { + if (tolower(*big) == tolower(*little)) + { + if (strncasecmp(big, little, len) == 0) + return (char *) big; + } + + big++; + } + + return NULL; +} +#endif /* __sun */ + string CUtils::GetIP(unsigned long addr) { char szBuf[16]; memset((char*) szBuf, 0, 16);