int strcmp(const char *s1, const char *s2)
{
int ret = 0;
while (!(ret = *(unsigned char *) s1 - *(unsigned char *) s2) && *s2) ++s1, ++s2;
if (ret < 0)
ret = -1;
else if (ret > 0)
ret = 1 ;
return ret;
}
I review the code from : http://www.jbox.dk/sanos/source/lib/string.c.html
I suppose that there're some problem.
If strlen(s2)>strlen(s1),then ++s1 may beyond the range. Unfortunately, then the function return error.