(file) Return to System.cpp CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

Diff for /pegasus/src/Pegasus/Common/System.cpp between version 1.29.2.1 and 1.31

version 1.29.2.1, 2005/09/29 03:25:00 version 1.31, 2005/10/12 20:08:10
Line 50 
Line 50 
 #include <cstring> #include <cstring>
 #include "System.h" #include "System.h"
 #include "Socket.h" #include "Socket.h"
 #include "CharSet.h"  
  
 #ifdef PEGASUS_PLATFORM_WIN32_IX86_MSVC #ifdef PEGASUS_PLATFORM_WIN32_IX86_MSVC
 # include <windows.h> # include <windows.h>
Line 98 
Line 97 
     return true;     return true;
 } }
  
   // ATTN: Move to platform-specific System implementation files and call
   // strcasecmp where it is available.
 Sint32 System::strcasecmp(const char* s1, const char* s2) Sint32 System::strcasecmp(const char* s1, const char* s2)
 { {
     // Note: this is faster than glibc strcasecmp().      while (*s1 && *s2)
       {
     Uint8* p = (Uint8*)s1;          int r = tolower(*s1++) - tolower(*s2++);
     Uint8* q = (Uint8*)s2;  
     int r;  
   
     for (;;)  
     {  
         if ((r = CharSet::to_lower(p[0]) - CharSet::to_lower(q[0])) || !p[0] ||  
             (r = CharSet::to_lower(p[1]) - CharSet::to_lower(q[1])) || !p[1] ||  
             (r = CharSet::to_lower(p[2]) - CharSet::to_lower(q[2])) || !p[2] ||  
             (r = CharSet::to_lower(p[3]) - CharSet::to_lower(q[3])) || !p[3])  
             break;  
  
         p += 4;          if (r)
         q += 4;              return r;
     }     }
  
     return r;      if (*s2)
           return -1;
       else if (*s1)
           return 1;
   
       return 0;
 } }
  
 // Return the just the file name from the path into basename // Return the just the file name from the path into basename
 char *System::extract_file_name(const char *fullpath, char *basename) char *System::extract_file_name(const char *fullpath, char *basename)
 { {
   char *p;  
   char buff[2048];  
   if (fullpath == NULL)   if (fullpath == NULL)
     {     {
       basename[0] = '\0';       basename[0] = '\0';
       return basename;       return basename;
     }     }
   strcpy(buff, fullpath);  
   for(p = buff + strlen(buff); p >= buff; p--)    for (const char* p = fullpath + strlen(fullpath) - 1; p >= fullpath; p--)
     {     {
       if (*p == '\\' || *p == '/')       if (*p == '\\' || *p == '/')
         {         {
Line 140 
Line 134 
           return basename;           return basename;
         }         }
     }     }
   
   strcpy(basename, fullpath);   strcpy(basename, fullpath);
   return basename;   return basename;
 } }
Line 259 
Line 254 
 #elif defined(PEGASUS_OS_OS400) #elif defined(PEGASUS_OS_OS400)
                 entry = gethostbyname(ebcdicHost);                 entry = gethostbyname(ebcdicHost);
 #elif defined(PEGASUS_OS_ZOS) #elif defined(PEGASUS_OS_ZOS)
                 char hostName[ PEGASUS_MAXHOSTNAMELEN ];                  char hostName[PEGASUS_MAXHOSTNAMELEN + 1];
                 if (String::equalNoCase("localhost",String(hostname)))                 if (String::equalNoCase("localhost",String(hostname)))
                 {                 {
                         gethostname( hostName, PEGASUS_MAXHOSTNAMELEN );                         gethostname( hostName, PEGASUS_MAXHOSTNAMELEN );
                           hostName[sizeof(hostName)-1] = 0;
                         entry = gethostbyname(hostName);                         entry = gethostbyname(hostName);
                 } else                 } else
                 {                 {


Legend:
Removed from v.1.29.2.1  
changed lines
  Added in v.1.31

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2