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

Defined functions

getufield defined in line 9; used 2 times
Last modified: 1995-02-09
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1626
Valid CSS Valid XHTML 1.0 Strict