|
|
1.1 root 1: #include "f2c.h"
2:
3: /* compare two strings */
4:
5: #ifdef KR_headers
6: integer s_cmp(a, b, la, lb) register char *a, *b; ftnlen la, lb;
7: #else
8: integer s_cmp(register char *a, register char *b, ftnlen la, ftnlen lb)
9: #endif
10: {
11: register char *aend, *bend;
12: aend = a + la;
13: bend = b + lb;
14:
15: if(la <= lb)
16: {
17: while(a < aend)
18: if(*a != *b)
19: return( *a - *b );
20: else
21: { ++a; ++b; }
22:
23: while(b < bend)
24: if(*b != ' ')
25: return( ' ' - *b );
26: else ++b;
27: }
28:
29: else
30: {
31: while(b < bend)
32: if(*a == *b)
33: { ++a; ++b; }
34: else
35: return( *a - *b );
36: while(a < aend)
37: if(*a != ' ')
38: return(*a - ' ');
39: else ++a;
40: }
41: return(0);
42: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.