PUTPWENT(3C)                                                      PUTPWENT(3C)


NAME
     putpwent - write password file entry

SYNOPSIS
     #include <pwd.h>

     int putpwent (const struct passwd *p, FILE *f);

DESCRIPTION
     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.

SEE ALSO
     getpwent(3C), getspent(3C), putspent(3C).

DIAGNOSTICS
     putpwent returns non-zero if an error was detected during its operation,
     otherwise zero.

WARNINGS
     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.


                                                                        Page 1