/*
* Copyright (c) 1987 Regents of the University of California.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that this notice is preserved and that due credit is given
* to the University of California at Berkeley. The name of the University
* may not be used to endorse or promote products derived from this
* software without specific written prior permission. This software
* is provided ``as is'' without express or implied warranty.
*/
for (;;) {
if (n == 0) {
/*
* We've run out of characters that we should
* compare, and they've all been equal; return
* 0, to indicate that the prefixes are the
* same.
*/
return(0);
}
if (cm[*us1] != cm[*us2++]) {
/*
* We've found a mismatch.
*/
break;
}
if (*us1++ == '\0') {
/*
* We've run out of characters *to* compare,
* and they've all been equal; return 0, to
* indicate that the strings are the same.
*/
return(0);
}
n--;
}
return(cm[*us1] - cm[*--us2]);
}