Last change
on this file was 1392, checked in by bird, 21 years ago |
This commit was generated by cvs2svn to compensate for changes in r1391,
which included commits to RCS files with non-trunk default branches.
|
-
Property cvs2svn:cvs-rev
set to
1.1.1.2
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
|
File size:
647 bytes
|
Line | |
---|
1 | #include "f2c.h"
|
---|
2 |
|
---|
3 | /* compare two strings */
|
---|
4 |
|
---|
5 | integer
|
---|
6 | s_cmp (char *a0, char *b0, ftnlen la, ftnlen lb)
|
---|
7 | {
|
---|
8 | register unsigned char *a, *aend, *b, *bend;
|
---|
9 | a = (unsigned char *) a0;
|
---|
10 | b = (unsigned char *) b0;
|
---|
11 | aend = a + la;
|
---|
12 | bend = b + lb;
|
---|
13 |
|
---|
14 | if (la <= lb)
|
---|
15 | {
|
---|
16 | while (a < aend)
|
---|
17 | if (*a != *b)
|
---|
18 | return (*a - *b);
|
---|
19 | else
|
---|
20 | {
|
---|
21 | ++a;
|
---|
22 | ++b;
|
---|
23 | }
|
---|
24 |
|
---|
25 | while (b < bend)
|
---|
26 | if (*b != ' ')
|
---|
27 | return (' ' - *b);
|
---|
28 | else
|
---|
29 | ++b;
|
---|
30 | }
|
---|
31 |
|
---|
32 | else
|
---|
33 | {
|
---|
34 | while (b < bend)
|
---|
35 | if (*a == *b)
|
---|
36 | {
|
---|
37 | ++a;
|
---|
38 | ++b;
|
---|
39 | }
|
---|
40 | else
|
---|
41 | return (*a - *b);
|
---|
42 | while (a < aend)
|
---|
43 | if (*a != ' ')
|
---|
44 | return (*a - ' ');
|
---|
45 | else
|
---|
46 | ++a;
|
---|
47 | }
|
---|
48 | return (0);
|
---|
49 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.