1: getpw(uid, buf)
   2: int uid;
   3: char buf[];
   4: {
   5:     auto pbuf[259];
   6:     static pwf;
   7:     register n, c;
   8:     register char *bp;
   9: 
  10:     if(pwf == 0)
  11:         pwf = open("/etc/passwd", 0);
  12:     if(pwf < 0)
  13:         return(1);
  14:     seek(pwf, 0, 0);
  15:     pbuf[0] = pwf;
  16:     pbuf[1] = 0;
  17:     pbuf[2] = 0;
  18:     uid =& 0377;
  19: 
  20:     for (;;) {
  21:         bp = buf;
  22:         while((c=getc(pbuf)) != '\n') {
  23:             if(c <= 0)
  24:                 return(1);
  25:             *bp++ = c;
  26:         }
  27:         *bp++ = '\0';
  28:         bp = buf;
  29:         n = 3;
  30:         while(--n)
  31:         while((c = *bp++) != ':')
  32:             if(c == '\n')
  33:                 return(1);
  34:         while((c = *bp++) != ':') {
  35:             if(c<'0' || c>'9')
  36:                 continue;
  37:             n = n*10+c-'0';
  38:         }
  39:         if(n == uid)
  40:             return(0);
  41:     }
  42:     return(1);
  43: }

Defined functions

getpw defined in line 1; used 3 times
Last modified: 1975-05-14
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 647
Valid CSS Valid XHTML 1.0 Strict