Doxygen Source Code Documentation
Main Page Alphabetical List Data Structures File List Data Fields Globals Search
s_cmp.c
Go to the documentation of this file.00001 #include "f2c.h"
00002
00003
00004
00005 #ifdef KR_headers
00006 integer s_cmp(a0, b0, la, lb) char *a0, *b0; ftnlen la, lb;
00007 #else
00008 integer s_cmp(char *a0, char *b0, ftnlen la, ftnlen lb)
00009 #endif
00010 {
00011 register unsigned char *a, *aend, *b, *bend;
00012 a = (unsigned char *)a0;
00013 b = (unsigned char *)b0;
00014 aend = a + la;
00015 bend = b + lb;
00016
00017 if(la <= lb)
00018 {
00019 while(a < aend)
00020 if(*a != *b)
00021 return( *a - *b );
00022 else
00023 { ++a; ++b; }
00024
00025 while(b < bend)
00026 if(*b != ' ')
00027 return( ' ' - *b );
00028 else ++b;
00029 }
00030
00031 else
00032 {
00033 while(b < bend)
00034 if(*a == *b)
00035 { ++a; ++b; }
00036 else
00037 return( *a - *b );
00038 while(a < aend)
00039 if(*a != ' ')
00040 return(*a - ' ');
00041 else ++a;
00042 }
00043 return(0);
00044 }