BSD 4 development
[unix-history] / usr / src / lib / libF77 / s_cmp.c
CommitLineData
15eea6e6
BJ
1int s_cmp(a, b, la, lb) /* compare two strings */
2register char *a, *b;
3long int la, lb;
4{
5register char *aend, *bend;
6aend = a + la;
7bend = b + lb;
8
9if(la <= lb)
10 {
11 while(a < aend)
12 if(*a != *b)
13 return( *a - *b );
14 else
15 { ++a; ++b; }
16
17 while(b < bend)
18 if(*b != ' ')
19 return( ' ' - *b );
20 else ++b;
21 }
22
23else
24 {
25 while(b < bend)
26 if(*a == *b)
27 { ++a; ++b; }
28 else
29 return( *a - *b );
30 while(a < aend)
31 if(*a != ' ')
32 return(*a - ' ');
33 else ++a;
34 }
35return(0);
36}