delorie.com/djgpp/doc/libc/libc_412.html | search |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
#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") */ char * pw_gecos; /* getlogin() */ char * pw_passwd; /* "" */ }; |
The pw_name
and pw_gecos
members are returned as described
under getlogin
(see section getlogin). The pw_uid
member is
returned as described under getuid
(see section getuid). pw_gid
is returned as described under getgid
(see section getgid). The
pw_passwd
member is set to the empty string. The pw_dir
member is set to the value of the environment variable HOME
if it
is defined, or to `/' otherwise. pw_shell
is set as
follows:
SHELL
is set, the value of
SHELL
.
SHELL
is not set, but the environment variable COMSPEC
is,
the value of COMSPEC
.
pw_shell
is set to
"sh"
.
The next passwd entry, or NULL
if there are no more.
ANSI/ISO C | No |
POSIX | No |
struct passwd *p; setpwent(); while ((p = getpwent()) != NULL) { printf("user %s name %s\n", p->pw_name, p->pw_gecos); } endpwent(); |
webmaster | delorie software privacy |
Copyright © 2004 | Updated Apr 2004 |