Annotation of 43BSDReno/contrib/isode-beta/compat/str2vec.c, revision 1.1

1.1     ! root        1: /* str2vec.c - string to vector */
        !             2: 
        !             3: #ifndef        lint
        !             4: static char *rcsid = "$Header: /f/osi/compat/RCS/str2vec.c,v 7.0 89/11/23 21:23:39 mrose Rel $";
        !             5: #endif
        !             6: 
        !             7: /* 
        !             8:  * $Header: /f/osi/compat/RCS/str2vec.c,v 7.0 89/11/23 21:23:39 mrose Rel $
        !             9:  *
        !            10:  *
        !            11:  * $Log:       str2vec.c,v $
        !            12:  * Revision 7.0  89/11/23  21:23:39  mrose
        !            13:  * Release 6.0
        !            14:  * 
        !            15:  */
        !            16: 
        !            17: /*
        !            18:  *                               NOTICE
        !            19:  *
        !            20:  *    Acquisition, use, and distribution of this module and related
        !            21:  *    materials are subject to the restrictions of a license agreement.
        !            22:  *    Consult the Preface in the User's Manual for the full terms of
        !            23:  *    this agreement.
        !            24:  *
        !            25:  */
        !            26: 
        !            27: 
        !            28: /* LINTLIBRARY */
        !            29: 
        !            30: #include <ctype.h>
        !            31: #include <stdio.h>
        !            32: #include "general.h"
        !            33: #include "manifest.h"
        !            34: 
        !            35: 
        !            36: #define        QUOTE   '\\'
        !            37: 
        !            38: /*  */
        !            39: 
        !            40: int    str2vecX (s, vec, nmask, mask, brk)
        !            41: register char  *s,
        !            42:              **vec,
        !            43:                brk;
        !            44: int    nmask,
        !            45:        *mask;
        !            46: {
        !            47:     register int    i;
        !            48: 
        !            49:     if (mask)
        !            50:        *mask = 0;
        !            51: 
        !            52:     for (i = 0; i <= NVEC;) {
        !            53:        vec[i] = NULL;
        !            54:        if (brk) {
        !            55:            if (i > 0 && *s == brk)
        !            56:                *s++ = NULL;
        !            57:        }
        !            58:        else
        !            59:            while (isspace (*s) || *s == ',')
        !            60:                *s++ = NULL;
        !            61:        if (*s == NULL)
        !            62:            break;
        !            63: 
        !            64:        if (*s == '"') {
        !            65:            if (i < nmask)
        !            66:                *mask |= 1 << i;
        !            67:            for (vec[i++] = ++s; *s != NULL && *s != '"'; s++)
        !            68:                if (*s == QUOTE) {
        !            69:                    if (*++s == '"')
        !            70:                        (void) strcpy (s - 1, s);
        !            71:                    s--;
        !            72:                }
        !            73:            if (*s == '"')
        !            74:                *s++ = NULL;
        !            75:            continue;
        !            76:        }
        !            77:        if (*s == QUOTE && *++s != '"')
        !            78:            s--;
        !            79:        vec[i++] = s;
        !            80: 
        !            81:        if (brk) {
        !            82:            if (*s != brk)
        !            83:                for (s++; *s != NULL && *s != brk; s++)
        !            84:                    continue;
        !            85:        }
        !            86:        else
        !            87:            for (s++; *s != NULL && !isspace (*s) && *s != ','; s++)
        !            88:                continue;
        !            89:     }
        !            90:     vec[i] = NULL;
        !            91: 
        !            92:     return i;
        !            93: }

unix.superglobalmegacorp.com

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