annotate ext/clapack/src/s_cmp.c @ 475:64fc3009d0a3

Switch from DOS to Unix line-endings
author Chris Cannam <cannam@all-day-breakfast.com>
date Thu, 30 May 2019 18:28:11 +0100
parents 905e45637745
children
rev   line source
c@427 1 #include "f2c.h"
c@427 2 #ifdef __cplusplus
c@427 3 extern "C" {
c@427 4 #endif
c@427 5
c@427 6 /* compare two strings */
c@427 7
c@427 8 #ifdef KR_headers
c@427 9 integer s_cmp(a0, b0, la, lb) char *a0, *b0; ftnlen la, lb;
c@427 10 #else
c@427 11 integer s_cmp(char *a0, char *b0, ftnlen la, ftnlen lb)
c@427 12 #endif
c@427 13 {
c@427 14 register unsigned char *a, *aend, *b, *bend;
c@427 15 a = (unsigned char *)a0;
c@427 16 b = (unsigned char *)b0;
c@427 17 aend = a + la;
c@427 18 bend = b + lb;
c@427 19
c@427 20 if(la <= lb)
c@427 21 {
c@427 22 while(a < aend)
c@427 23 if(*a != *b)
c@427 24 return( *a - *b );
c@427 25 else
c@427 26 { ++a; ++b; }
c@427 27
c@427 28 while(b < bend)
c@427 29 if(*b != ' ')
c@427 30 return( ' ' - *b );
c@427 31 else ++b;
c@427 32 }
c@427 33
c@427 34 else
c@427 35 {
c@427 36 while(b < bend)
c@427 37 if(*a == *b)
c@427 38 { ++a; ++b; }
c@427 39 else
c@427 40 return( *a - *b );
c@427 41 while(a < aend)
c@427 42 if(*a != ' ')
c@427 43 return(*a - ' ');
c@427 44 else ++a;
c@427 45 }
c@427 46 return(0);
c@427 47 }
c@427 48 #ifdef __cplusplus
c@427 49 }
c@427 50 #endif