Annotation of 42BSD/ingres/source/gutil/getufield.c, revision 1.1.1.1

1.1       root        1: # include      <sccs.h>
                      2: 
                      3: SCCSID(@(#)getufield.c 7.1     2/5/81)
                      4: 
                      5: /*
                      6: **  GETUFIELD -- extract field from users file
                      7: **
                      8: **     A buffer returned as the result of a getuser() (or getpw())
                      9: **     call is scanned for the indicated parameter, numbered from
                     10: **     zero.  A pointer to the parameter is returned.
                     11: */
                     12: 
                     13: char *
                     14: getufield(buf, num)
                     15: char   *buf;
                     16: int    num;
                     17: {
                     18:        register char   c;
                     19:        register int    i;
                     20:        register char   *p;
                     21:        char            *r;
                     22: 
                     23:        p = buf;
                     24: 
                     25:        /* skip other fields */
                     26:        for (i = num; i > 0; i--)
                     27:        {
                     28:                while ((c = *p++) != 0)
                     29:                        if (c == ':')
                     30:                                break;
                     31:        }
                     32: 
                     33:        /* save result pointer */
                     34:        r = p;
                     35: 
                     36:        /* null-terminate this field */
                     37:        while ((c = *p++) != 0)
                     38:                if (c == ':')
                     39:                        break;
                     40: 
                     41:        *--p = 0;
                     42: 
                     43:        return (r);
                     44: }

unix.superglobalmegacorp.com

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