/* Copyright (c) 2001-2009 by SoftIntegration, Inc. All Rights Reserved */
/***********************************************************
* Function File: memcmp.c
*
* Note: (1)  ANSI C function in standard lib string.h
*       (2)  copy compare s2[] to s1[]
*
* History: created by Harry H. Cheng, 2/19/1994
**********************************************************/
#include <string.h>
int memcmp(void *s1, void *s2, size_t n)
{
  char *ss1, *ss2;
  
  if(s1 == NULL)
    return -1;
  else if(s2 == NULL)
  {
    return 1;
  }
  else
  {
    for(ss1 = s1, ss2 = s2; 0 < n; ss1++, ss2++, n--)
      if(*ss1 != *ss2)
      {
        if(*ss1 < *ss2) return -1;
        else return 1;
      }
    return 0;
  }
}
