src/stdlib/SDL_string.c
changeset 1501 73dc5d39bbf8
parent 1456 84de7511f79f
child 1510 720f8bb49d7d
     1.1 --- a/src/stdlib/SDL_string.c	Sun Mar 12 01:47:23 2006 +0000
     1.2 +++ b/src/stdlib/SDL_string.c	Mon Mar 13 01:08:00 2006 +0000
     1.3 @@ -661,12 +661,12 @@
     1.4  }
     1.5  #endif
     1.6  
     1.7 -#ifndef HAVE_STRCASECMP
     1.8 +#if !defined(HAVE_STRCASECMP) && !defined(HAVE_STRICMP)
     1.9  int SDL_strcasecmp(const char *str1, const char *str2)
    1.10  {
    1.11      char a = 0;
    1.12      char b = 0;
    1.13 -    while (*str1 && *str2) {
    1.14 +    while ( *str1 && *str2 ) {
    1.15          a = SDL_tolower(*str1);
    1.16          b = SDL_tolower(*str2);
    1.17          if ( a != b )
    1.18 @@ -678,6 +678,24 @@
    1.19  }
    1.20  #endif
    1.21  
    1.22 +#ifndef HAVE_STRNCASECMP
    1.23 +int SDL_strncasecmp(const char *str1, const char *str2, size_t maxlen)
    1.24 +{
    1.25 +    char a = 0;
    1.26 +    char b = 0;
    1.27 +    while ( *str1 && *str2 && maxlen ) {
    1.28 +        a = SDL_tolower(*str1);
    1.29 +        b = SDL_tolower(*str2);
    1.30 +        if ( a != b )
    1.31 +            break;
    1.32 +        ++str1;
    1.33 +        ++str2;
    1.34 +        --maxlen;
    1.35 +    }
    1.36 +    return (int)((unsigned char)a - (unsigned char)b);
    1.37 +}
    1.38 +#endif
    1.39 +
    1.40  #ifndef HAVE_SSCANF
    1.41  int SDL_sscanf(const char *text, const char *fmt, ...)
    1.42  {