/* Naive substitute implementation of memcmp() */

#include <sys/types.h>

int memcmp(const void *s1, const void *s2, size_t n){
  size_t counter = 0;
  for (;counter < n; counter++) {
    int res = ((unsigned char*)s1)[counter] -
      ((unsigned char*)s2)[counter];
    if (0 != res)
      return res;
  }
  return 0;
}


syntax highlighted by Code2HTML, v. 0.9.1