HP-UX Reference (11i v1 05/09) - 3 Library Functions A-M (vol 6)

g
getpwent(3C) getpwent(3C)
nsswitch.conf(4).) An application that uses these interfaces cannot be fully archive bound.
EXAMPLE
The following code excerpt prints name and uid of 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
See Also
niscat(1), ypcat(1).
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
Section 3372 Hewlett-Packard Company 3 HP-UX 11i Version 1: September 2005