HP-UX Reference (11i v2 04/09) - 3 Library Functions A-M (vol 6)
g
getpwent(3C) getpwent(3C)
Users of getpwuid_r() and getpwnam_r() should note that these interfaces now conform with
POSIX.1c. getpwent_r(), setpwent_r(), endpwent_r() and
fgetpwent_r() are obsolescent
interfaces. These interfaces and the old prototypes of
getpwuid_r() and getpwnam_r() are sup-
ported for compatibility with existing DCE applications only.
The interfaces
getpwuid(), getpwnam(), getpwent(),
setpwent(), endpwent(),
fgetpwent(), getpwuid_r() and getpwnam_r() use the Dynamic Name Service Switch. See
nsswitch.conf(4). An application that uses these interfaces cannot be fully archive bound.
EXAMPLE
The following code excerpt prints name and uid of a user logged in on this terminal:
struct passwd pwd;
struct passwd *result;
char logBuffer [1024];
char pwdBuffer [1024];
if (getlogin_r (loginBuffer, 1024) == 0)
if (getpwnam_r (logBuffer, &pwd, pwdBuffer, 1024, &result) == 0)
printf ("Name = %s; uid = %d\n", pwd.pw_name, pwd.pw_uid);
DEPENDENCIES
NFS
Files
/var/yp/domainname/passwd.byname
/var/yp/domainname/passwd.byuid
/var/nis/hostname/passwd.org_dir
AUTHOR
getpwent(), getpwuid(), getpwnam(), setpwent(), endpwent(), and fgetpwent() were
developed by Sun and HP.
FILES
/etc/passwd System Password file
SEE ALSO
niscat(1), ypcat(1), cuserid(3S), getgrent(3C), getlogin(3C), getprpwent(3), getspwent(3X), stdio(3S),
putpwent(3C), nsswitch.conf(4), passwd(4), limits(5), thread_safety(5).
STANDARDS CONFORMANCE
getpwent(): SVID2, SVID3, XPG2
endpwent(): SVID2, SVID3, XPG2
fgetpwent(): SVID2, SVID3, XPG2
getpwnam(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1
getpwuid(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1
setpwent(): SVID2, SVID3, XPG2
HP-UX 11i Version 2: September 2004 − 3 − Hewlett-Packard Company Section 3−−427