Back to index

cell-binutils  2.17cvs20070401
Functions
strncmp.c File Reference
#include <ansidecl.h>
#include <stddef.h>

Go to the source code of this file.

Functions

int strncmp (const char *s1, const char *s2, register size_t n)

Function Documentation

int strncmp ( const char *  s1,
const char *  s2,
register size_t  n 
)

Definition at line 19 of file strncmp.c.

{
  register unsigned char u1, u2;

  while (n-- > 0)
    {
      u1 = (unsigned char) *s1++;
      u2 = (unsigned char) *s2++;
      if (u1 != u2)
       return u1 - u2;
      if (u1 == '\0')
       return 0;
    }
  return 0;
}