Back to index

glibc  2.9
Functions
strcmp.c File Reference
#include <string.h>
#include <memcopy.h>

Go to the source code of this file.

Functions

int strcmp (char *p1, const char *p2) const

Function Documentation

int strcmp ( char *  p1,
const char *  p2 
) const

Definition at line 28 of file strcmp.c.

{
  register const unsigned char *s1 = (const unsigned char *) p1;
  register const unsigned char *s2 = (const unsigned char *) p2;
  unsigned reg_char c1, c2;

  do
    {
      c1 = (unsigned char) *s1++;
      c2 = (unsigned char) *s2++;
      if (c1 == '\0')
       return c1 - c2;
    }
  while (c1 == c2);

  return c1 - c2;
}