OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [newlib/] [libc/] [string/] [strncasecmp.c] - Diff between revs 39 and 56

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 39 Rev 56
Line 32... Line 32...
 
 
PORTABILITY
PORTABILITY
<<strncasecmp>> is in the Berkeley Software Distribution.
<<strncasecmp>> is in the Berkeley Software Distribution.
 
 
<<strncasecmp>> requires no supporting OS subroutines. It uses
<<strncasecmp>> requires no supporting OS subroutines. It uses
toupper() from elsewhere in this library.
tolower() from elsewhere in this library.
 
 
QUICKREF
QUICKREF
        strncasecmp
        strncasecmp
*/
*/
 
 
Line 50... Line 50...
        size_t n)
        size_t n)
{
{
  if (n == 0)
  if (n == 0)
    return 0;
    return 0;
 
 
  while (n-- != 0 && toupper(*s1) == toupper(*s2))
  while (n-- != 0 && tolower(*s1) == tolower(*s2))
    {
    {
      if (n == 0 || *s1 == '\0' || *s2 == '\0')
      if (n == 0 || *s1 == '\0' || *s2 == '\0')
        break;
        break;
      s1++;
      s1++;
      s2++;
      s2++;
    }
    }
 
 
  return toupper(*(unsigned char *) s1) - toupper(*(unsigned char *) s2);
  return tolower(*(unsigned char *) s1) - tolower(*(unsigned char *) s2);
}
}
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2025 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.