home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
usenet
/
altsrcs
/
1
/
1350
/
getpwuid.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-12-28
|
457b
|
32 lines
/*
* getpwuid.c: Get password file entry by user id
*
* Stephen C. Trier
* March 26, 1990
*
* This program is in the public domain
*
*/
#include <stdio.h>
#include <pwd.h>
extern FILE *_pw_file;
struct passwd *getpwuid(int id)
{
struct passwd *temp;
if (setpwent())
return NULL;
while (temp = getpwent())
if (temp->pw_uid == id) {
setpwent();
return temp;
}
setpwent();
return NULL;
}