|
|
1.1 ! root 1: /* Copyright Bell Telephone Laboratories Whippany, N.J. ! 2: ! 3: * ///////////////////////////////////// ! 4: * ///////////////////////////////////// ! 5: * ////////////// equal.c ////////////// ! 6: * /// J. P. Hawkins WH X4610 8C-001 /// ! 7: * ///// Sun Aug 26 08:11:11 1979 ////// ! 8: * ///////////////////////////////////// ! 9: * ///////////////////////////////////// ! 10: ! 11: * ! 12: * This function is similar, but NOT the same as strcmp ! 13: * If the string being tested begins with the character string ! 14: * being compared to the test passes and is non-zero (length of string) ! 15: * If the test fails a zero is returned. ! 16: * this philosophy lends itself to code that appears like ! 17: * if(equal(buf,"jim")) ! 18: */ ! 19: /* "@(#) equal.c: V 1.1 12/21/80" */ ! 20: equal(ptr,string) ! 21: char *ptr; ! 22: char *string; ! 23: { ! 24: register char *i, *j; ! 25: i = ptr; ! 26: j = string; ! 27: ! 28: while((*i == *j) && (*j != '\0')) ! 29: { ! 30: j++; ! 31: i++; ! 32: } ! 33: if(*j == '\0') ! 34: return(j - string); ! 35: return(0); ! 36: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.