home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Source Code 1992 March
/
Source_Code_CD-ROM_Walnut_Creek_March_1992.iso
/
usenet
/
altsrcs
/
1
/
1350
/
getpwent.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-12-28
|
583b
|
34 lines
/*
* getpwent.c: Get next password file entry
*
* 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 *getpwent(void)
{
static struct passwd temp;
if ((_pw_file == NULL) && (!pw_openfile(NULL)))
return NULL;
if (fscanf(_pw_file, "%[^:]:%[^:]:%d:%d:%[^:]:%[^:]:%[^:\n] ", temp.pw_name,
temp.pw_passwd, &(temp.pw_uid), &(temp.pw_gid), temp.pw_gecos,
temp.pw_dir, temp.pw_shell) == 7)
return &temp;
else
return NULL;
}