2 * getpw - get a password from the password file
4 /* $Id: getpw.c,v 1.2 1994/06/24 11:45:21 ceriel Exp $ */
8 getpw(int uid, char buf[])
14 pwf = fopen("/etc/passwd", "r");
15 if (pwf == NULL) return(1);
19 while ((ch = getc(pwf)) != '\n') {
20 if (ch == EOF) return 1;
26 while ((ch = *bp++) != ':') {
27 if(ch = '\0') return 1;
31 while ((ch = *bp++) != ':') {
32 if (ch < '0' || ch > '9') return 1;
33 i = i * 10 + (ch - '0');
35 if (i == uid) return(0);