Annotation of researchv10no/cmd/xref/string.c, revision 1.1

1.1     ! root        1: #
        !             2: /*
        !             3:  *
        !             4:  * S. R. Bourne
        !             5:  * Bell Telephone Laboratories
        !             6:  *
        !             7:  */
        !             8: 
        !             9: #include       "defs.h"
        !            10: 
        !            11: 
        !            12: /* ========    general purpose string handling ======== */
        !            13: 
        !            14: 
        !            15: STRING movstr(a,b)
        !            16:        REG STRING      a, b;
        !            17: {
        !            18:        WHILE *b++ = *a++ DONE
        !            19:        return(--b);
        !            20: }
        !            21: 
        !            22: INT    any(c,s)
        !            23:        REG CHAR        c;
        !            24:        STRING          s;
        !            25: {
        !            26:        REG CHAR d;
        !            27: 
        !            28:        WHILE d = *s++
        !            29:        DO      IF d==c
        !            30:                THEN    return(TRUE);
        !            31:                FI
        !            32:        OD
        !            33:        return(FALSE);
        !            34: }
        !            35: 
        !            36: INT    cf(s1, s2)
        !            37:        REG STRING s1, s2;
        !            38: {
        !            39:        WHILE *s1++ == *s2
        !            40:        DO      IF *s2++==0
        !            41:                THEN    return(0);
        !            42:                FI
        !            43:        OD
        !            44:        return(*--s1 - *s2);
        !            45: }
        !            46: 
        !            47: INT    length(as)
        !            48:        STRING as;
        !            49: {
        !            50:        REG STRING s;
        !            51: 
        !            52:        IF s=as THEN WHILE *s++ DONE FI
        !            53:        return(s-as);
        !            54: }

unix.superglobalmegacorp.com

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