s_cmp.c
Go to the documentation of this file.
00001 #include "f2c.h"
00002 #ifdef __cplusplus
00003 extern "C" {
00004 #endif
00005 
00006 /* compare two strings */
00007 
00008 #ifdef KR_headers
00009 integer s_cmp(a0, b0, la, lb) char *a0, *b0; ftnlen la, lb;
00010 #else
00011 integer s_cmp(char *a0, char *b0, ftnlen la, ftnlen lb)
00012 #endif
00013 {
00014 register unsigned char *a, *aend, *b, *bend;
00015 a = (unsigned char *)a0;
00016 b = (unsigned char *)b0;
00017 aend = a + la;
00018 bend = b + lb;
00019 
00020 if(la <= lb)
00021         {
00022         while(a < aend)
00023                 if(*a != *b)
00024                         return( *a - *b );
00025                 else
00026                         { ++a; ++b; }
00027 
00028         while(b < bend)
00029                 if(*b != ' ')
00030                         return( ' ' - *b );
00031                 else    ++b;
00032         }
00033 
00034 else
00035         {
00036         while(b < bend)
00037                 if(*a == *b)
00038                         { ++a; ++b; }
00039                 else
00040                         return( *a - *b );
00041         while(a < aend)
00042                 if(*a != ' ')
00043                         return(*a - ' ');
00044                 else    ++a;
00045         }
00046 return(0);
00047 }
00048 #ifdef __cplusplus
00049 }
00050 #endif


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:56