Logo Search packages:      
Sourcecode: yasm version File versions  Download package

int yasm__strncasecmp ( const char *  s1,
const char *  s2,
size_t  n 
)

Compare portion of two strings, ignoring case differences.

For internal use only.

Parameters:
s1 string 1
s2 string 2
n maximum number of characters to compare
Returns:
0 if strings are equal, -1 if s1<s2, 1 if s1>s2.

Definition at line 70 of file strcasecmp.c.

References yasm__strncasecmp().

Referenced by yasm__strncasecmp().

{
#ifdef HAVE_STRCASECMP
    return strncasecmp(s1, s2, n);
#elif HAVE_STRICMP
    return strnicmp(s1, s2, n);
#elif HAVE_STRCMPI
    return strncmpi(s1, s2, n);
#else
      const unsigned char
                  *us1 = (const unsigned char *)s1,
                  *us2 = (const unsigned char *)s2;

      if (n != 0) {
            do {
                  if (tolower(*us1) != tolower(*us2++))
                        return (tolower(*us1) - tolower(*--us2));
                  if (*us1++ == '\0')
                        break;
            } while (--n != 0);
      }
      return (0);
#endif
}


Generated by  Doxygen 1.6.0   Back to index