Annotation of 43BSDReno/bin/sh/string.c, revision 1.1

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

unix.superglobalmegacorp.com

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