Last change
on this file since 6a37d5b was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 7 years ago |
Imported original source code.
|
-
Property mode
set to
100755
|
File size:
461 bytes
|
Rev | Line | |
---|
[3ae31e9] | 1 | /*
|
---|
| 2 | =============================================================================
|
---|
| 3 | strcmp.c -- compare strings
|
---|
| 4 | Version 2 -- 1987-06-15
|
---|
| 5 |
|
---|
| 6 | Compare strings: s1>s2: >0 s1==s2: 0 s1<s2: <0
|
---|
| 7 | =============================================================================
|
---|
| 8 | */
|
---|
| 9 |
|
---|
| 10 | int
|
---|
| 11 | strcmp(s1, s2)
|
---|
| 12 | register char *s1, *s2;
|
---|
| 13 | {
|
---|
| 14 | if(s1 == s2)
|
---|
| 15 | return(0);
|
---|
| 16 |
|
---|
| 17 | while(*s1 == *s2++)
|
---|
| 18 | if(*s1++ == '\0')
|
---|
| 19 | return(0);
|
---|
| 20 |
|
---|
| 21 | return((int)*s1 - (int)*--s2);
|
---|
| 22 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.