1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\" References consulted:
6 .\" Linux libc source code
7 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
9 .\" Modified Sat Jul 24 19:23:25 1993 by Rik Faith (faith@cs.unc.edu)
10 .\" Modified Mon May 27 21:37:47 1996 by Martin Schulze (joey@linux.de)
12 .TH getpw 3 (date) "Linux man-pages (unreleased)"
14 getpw \- reconstruct password line entry
17 .RI ( libc ", " \-lc )
20 .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */"
21 .B #include <sys/types.h>
24 .BI "[[deprecated]] int getpw(uid_t " uid ", char *" buf );
29 function reconstructs the password line entry for
30 the given user ID \fIuid\fP in the buffer \fIbuf\fP.
31 The returned buffer contains a line of format
35 .B name:passwd:uid:gid:gecos:dir:shell
39 The \fIpasswd\fP structure is defined in \fI<pwd.h>\fP as follows:
44 char *pw_name; /* username */
45 char *pw_passwd; /* user password */
46 uid_t pw_uid; /* user ID */
47 gid_t pw_gid; /* group ID */
48 char *pw_gecos; /* user information */
49 char *pw_dir; /* home directory */
50 char *pw_shell; /* shell program */
55 For more information about the fields of this structure, see
60 function returns 0 on success; on error, it returns \-1, and
62 is set to indicate the error.
66 is not found in the password database,
76 No user corresponding to
84 Insufficient memory to allocate
90 password database file
92 For an explanation of the terms used in this section, see
100 Interface Attribute Value
103 T} Thread safety MT-Safe locale
113 function is dangerous as it may overflow the provided buffer