Annotation of researchv9/cmd/tbl/ts.c, revision 1.1

1.1     ! root        1:  /* ts.c: minor string processing subroutines */
        !             2: match (s1, s2)
        !             3:        char *s1, *s2;
        !             4: {
        !             5:        while (*s1 == *s2)
        !             6:                if (*s1++ == '\0')
        !             7:                        return(1);
        !             8:                else
        !             9:                        s2++;
        !            10:        return(0);
        !            11: }
        !            12: prefix(small, big)
        !            13:        char *small, *big;
        !            14: {
        !            15: int c;
        !            16: while ((c= *small++) == *big++)
        !            17:        if (c==0) return(1);
        !            18: return(c==0);
        !            19: }
        !            20: letter (ch)
        !            21:        {
        !            22:        if (ch >= 'a' && ch <= 'z')
        !            23:                return(1);
        !            24:        if (ch >= 'A' && ch <= 'Z')
        !            25:                return(1);
        !            26:        return(0);
        !            27:        }
        !            28: numb(str)
        !            29:        char *str;
        !            30:        {
        !            31:        /* convert to integer */
        !            32:        int k;
        !            33:        for (k=0; *str >= '0' && *str <= '9'; str++)
        !            34:                k = k*10 + *str - '0';
        !            35:        return(k);
        !            36:        }
        !            37: digit(x)
        !            38:        {
        !            39:        return(x>= '0' && x<= '9');
        !            40:        }
        !            41: max(a,b)
        !            42: {
        !            43: return( a>b ? a : b);
        !            44: }
        !            45: tcopy (s,t)
        !            46:        char *s, *t;
        !            47: {
        !            48:        while (*s++ = *t++);
        !            49: }

unix.superglobalmegacorp.com

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