Annotation of 43BSDReno/contrib/isode-beta/compat/str2elem.c, revision 1.1.1.1

1.1       root        1: /* str2elem.c - string to list of integers */
                      2: 
                      3: #ifndef        lint
                      4: static char *rcsid = "$Header: /f/osi/compat/RCS/str2elem.c,v 7.0 89/11/23 21:23:35 mrose Rel $";
                      5: #endif
                      6: 
                      7: /* 
                      8:  * $Header: /f/osi/compat/RCS/str2elem.c,v 7.0 89/11/23 21:23:35 mrose Rel $
                      9:  *
                     10:  *
                     11:  * $Log:       str2elem.c,v $
                     12:  * Revision 7.0  89/11/23  21:23:35  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: 
                     37: int    str2elem (s, elements)
                     38: char   *s;
                     39: unsigned int elements[];
                     40: {
                     41:     register int    i;
                     42:     register unsigned int  *ip;
                     43:     register char  *cp,
                     44:                    *dp;
                     45: 
                     46:     ip = elements, i = 0;
                     47:     for (cp = s; *cp && i <= NELEM; cp = ++dp) {
                     48:        for (dp = cp; isdigit (*dp); dp++)
                     49:            continue;
                     50:        if ((cp == dp) || (*dp && *dp != '.'))
                     51:            break;
                     52:        *ip++ = (unsigned int) atoi (cp), i++;
                     53:        if (*dp == NULL)
                     54:            break;
                     55:     }
                     56:     if (*dp || i >= NELEM)
                     57:        return NOTOK;
                     58:     *ip = 0;
                     59: 
                     60:     return i;
                     61: }

unix.superglobalmegacorp.com

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