Annotation of coherent/b/lib/libc/string/strtok.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * strtok.c
        !             3:  * ANSI 4.11.5.8.
        !             4:  * Break string into tokens.
        !             5:  */
        !             6: 
        !             7: #include <stddef.h>
        !             8: #include <string.h>
        !             9: 
        !            10: char *
        !            11: strtok(s1, s2) register char *s1; char *s2;
        !            12: {
        !            13:        static char *cp1;
        !            14: 
        !            15:        if (s1 != NULL)
        !            16:                cp1 = s1;               /* reset static start pointer */
        !            17:        s1 = cp1 + strspn(cp1, s2);     /* skip leading delimiters */
        !            18:        if (*s1 == '\0')
        !            19:                return(NULL);           /* no more tokens */
        !            20:        cp1 = s1 + strcspn(s1, s2);     /* skip nondelimiters */
        !            21:        if (*cp1 != '\0')
        !            22:                *cp1++ = '\0';          /* NUL-terminate token */
        !            23:        return(s1);
        !            24: }

unix.superglobalmegacorp.com

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