Annotation of 42BSD/usr.lib/libF77/s_cmp.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  *     "@(#)s_cmp.c    1.1"
                      3:  */
                      4: 
                      5: int s_cmp(a, b, la, lb)        /* compare two strings */
                      6: register char *a, *b;
                      7: long int la, lb;
                      8: {
                      9: register char *aend, *bend;
                     10: aend = a + la;
                     11: bend = b + lb;
                     12: 
                     13: if(la <= lb)
                     14:        {
                     15:        while(a < aend)
                     16:                if(*a != *b)
                     17:                        return( *a - *b );
                     18:                else
                     19:                        { ++a; ++b; }
                     20: 
                     21:        while(b < bend)
                     22:                if(*b != ' ')
                     23:                        return( ' ' - *b );
                     24:                else    ++b;
                     25:        }
                     26: 
                     27: else
                     28:        {
                     29:        while(b < bend)
                     30:                if(*a == *b)
                     31:                        { ++a; ++b; }
                     32:                else
                     33:                        return( *a - *b );
                     34:        while(a < aend)
                     35:                if(*a != ' ')
                     36:                        return(*a - ' ');
                     37:                else    ++a;
                     38:        }
                     39: return(0);
                     40: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.