Annotation of researchv10no/ipc/bin/ftp/str.c, revision 1.1

1.1     ! root        1: #include <ctype.h>
        !             2: 
        !             3: char
        !             4: lc(ch)
        !             5: char ch;
        !             6: {
        !             7:        if (isupper(ch))
        !             8:                return(tolower(ch));
        !             9:        else
        !            10:                return(ch);
        !            11: }
        !            12: 
        !            13: /*
        !            14:  * Compare strings:  s1>s2: >0  s1==s2: 0  s1<s2: <0
        !            15:  */
        !            16: 
        !            17: strcasecmp(s1, s2)
        !            18: register char *s1, *s2;
        !            19: {
        !            20: 
        !            21:        while (lc(*s1) == lc(*s2++))
        !            22:                if (*s1++=='\0')
        !            23:                        return(0);
        !            24:        return(lc(*s1) - lc(*--s2));
        !            25: }
        !            26: 
        !            27: /*
        !            28:  * Compare strings (at most n bytes):  s1>s2: >0  s1==s2: 0  s1<s2: <0
        !            29:  */
        !            30: 
        !            31: strncasecmp(s1, s2, n)
        !            32: register char *s1, *s2;
        !            33: register n;
        !            34: {
        !            35: 
        !            36:        while (--n >= 0 && lc(*s1) == lc(*s2++))
        !            37:                if (*s1++ == '\0')
        !            38:                        return(0);
        !            39:        return(n<0 ? 0 : lc(*s1) - lc(*--s2));
        !            40: }

unix.superglobalmegacorp.com

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