/* Compare S1 and S2, returning less than, equal to or greater than zero if S1 is lexicographically less than, equal to or greater than S2. */ int STRCMP(constchar *p1, constchar *p2) { constunsignedchar *s1 = (constunsignedchar *) p1; constunsignedchar *s2 = (constunsignedchar *) p2; unsignedchar c1, c2;
do { c1 = (unsignedchar) *s1++; c2 = (unsignedchar) *s2++; if (c1 == '\0') return c1 - c2; } while (c1 == c2);