.\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk) .\" May be distributed under the GNU General Public License .\" References consulted: .\" Linux libc source code .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991) .\" 386BSD man pages .\" Modified Sat Jul 24 19:23:25 1993 by Rik Faith (faith@cs.unc.edu) .TH GETPW 3 "April 9, 1993" "GNU" "Linux Programmer's Manual" .SH NAME getpw \- Re-construct password line entry .SH SYNOPSIS .nf .B #include .B #include .sp .BI "int getpw(uid_t " uid ", char *" buf ); .fi .SH DESCRIPTION The \fBgetpw()\fP function re-constructs the password line entry for the given user uid \fIuid\fP in the buffer \fIbuf\fP. The returned buffer contains a line of format .sp .RS .B name:passwd:uid:gid:gecos:dir:shell .RE .PP The \fIpasswd\fP structure is defined in \fI\fP as follows: .sp .RS .nf .ta 8n 16n 32n struct passwd { char *pw_name; /* user name */ char *pw_passwd; /* user password */ uid_t pw_uid; /* user id */ gid_t pw_gid; /* group id */ char *pw_gecos; /* real name */ char *pw_dir; /* home directory */ char *pw_shell; /* shell program */ }; .ta .fi .RE .SH "RETURN VALUE" The \fBgetpw()\fP function returns 0 on success, or -1 if an error occurs. .SH ERRORS .TP .B ENOMEM Insufficient memory to allocate passwd structure. .SH FILES .nf /etc/passwd password database file .fi .SH SEE ALSO .BR fgetpwent "(3), " getpwent "(3), " setpwent "(3), " endpwent (3), .BR getpwnam "(3), " getpwuid "(3), " putpwent (3)