repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
* gcj.texi (Compatibility): Add Limitations and Extensions section.
[official-gcc.git]
/
libf2c
/
libF77
/
s_cmp.c
blob
5b43c9edb9c3fa8694016894fad772ac241871c3
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
}