00001 00007 /* Embedded XINU, Copyright (C) 2007. All rights reserved. */ 00008 00016 int strncmp(char *s1, char *s2, int n) 00017 { 00018 00019 while (--n >= 0 && *s1 == *s2++) 00020 { 00021 if (*s1++ == '\0') 00022 { return 0; } 00023 } 00024 return (n<0 ? 0 : *s1 - *--s2); 00025 }