#include <pwd.h> struct passwd *getpwent(void);
This function retrieves the next available password file entry. For MS-DOS, this is simulated by providing exactly one entry:
struct passwd { char * pw_name; /* getlogin() */ int pw_uid; /* getuid() */ int pw_gid; /* getgid() */ char * pw_dir; /* "/" or getenv("HOME") */ char * pw_shell; /* "/bin/sh" or getenv("SHELL") */ };
The next passwd entry, or NULL
if there are no more.
not ANSI, not POSIX
struct passwd *p; setpwent(); while ((p = getpwent()) != NULL) { printf("user %s name %s\n", p->pw_name, p->pw_gecos); } endpwent();
Go to the first, previous, next, last section, table of contents.