syscons util remove use kbdcontrol & vidcontrol instead
[unix-history] / lib / libF77 / s_cmp.c
CommitLineData
547779a8
WH
1#include "f2c.h"
2
3/* compare two strings */
4
5#ifdef KR_headers
6integer s_cmp(a, b, la, lb) register char *a, *b; ftnlen la, lb;
7#else
8integer s_cmp(register char *a, register char *b, ftnlen la, ftnlen lb)
9#endif
10{
11register char *aend, *bend;
12aend = a + la;
13bend = b + lb;
14
15if(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
29else
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 }
41return(0);
42}