Annotation of 41BSD/cmd/sh/string.c, revision 1.1.1.1

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

unix.superglobalmegacorp.com

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