PUTPWENT(3C) PUTPWENT(3C)
putpwent - write password file entry
#include <pwd.h>
int putpwent (const struct passwd *p, FILE *f);
putpwent is the inverse of getpwent(3C). Given a pointer to a passwd
structure created by getpwent (or getpwuid or getpwnam), putpwent writes
a line on the stream f, which matches the format of /etc/passwd.
getpwent(3C), getspent(3C), putspent(3C).
putpwent returns non-zero if an error was detected during its operation,
otherwise zero.
The above routine uses <stdio.h>, which causes it to increase the size of
programs, not otherwise using standard I/O, more than might be expected.
This call is only useful in a loop with getpwent(3C). If NIS
interpretation of '+' fields is not disabled, the entire contents of the
NIS passwd map will then end up in /etc/passwd. This is most likely not
the desired effect. See the _getpwnet_no_yp and _getpwent_no_shadow
variables in getpwent(3C) for a solution.
PPPPaaaaggggeeee 1111 [ Back ]
|