getpwent_r

Name

getpwent_r -- reentrantly get entry in passwd file

Synopsis

#include <pwd.h>

int getpwent_r(struct passwd * pwbuf, char * buf, size_t buflen, struct passwd * * pwbufp);

Description

The reentrant interface getpwent_r() shall function in the same way as the interface getpwent(), except that getpwent_r() shall return the user name, user password, GECOS field, home directory, and shell program in buffers provided by the caller, rather than as a pointer to static storage.

The parameter pwbuf contains the struct passwd that was read from the stream, if any.

The parameter buf contains additional strings, if any.

The parameter buflen specifies the size of buf.

The parameter *pwbufp returns a pointer to the struct passwd in *pwbuf.

Return Value

On success, getpwent_r() shall return 0, and *pwbufp shall contain a pointer to the result.

On failure, *pwbufp shall contain NULL, and getpwent_r() shall return an error as follows.

Errors

ENOENT 

No more password entries.

ERANGE 

Not enough buffer space. Specify a larger buffer and try again.