GETPWENT(3C) COMMAND REFERENCE GETPWENT(3C) NAME getpwent, getpwuid, getpwnam, setpwent, endpwent - get password file entry SYNOPSIS #include <pwd.h> struct passwd *getpwent() struct passwd *getpwuid(uid) int uid; struct passwd *getpwnam(name) char *name; int setpwent() int endpwent() DESCRIPTION Getpwent, getpwuid, and getpwnam each return a pointer to an object with the following structure containing the broken- out fields of a line in the password file. /* * pwd.h * * Modifications from 4.2bsd * Copyright (c) 1984, Tektronix Inc. * All Rights Reserved */ struct passwd { /* see getpwent(3) */ char *pw_name; char *pw_passwd; int pw_uid; int pw_gid; int pw_quota; char *pw_comment; char *pw_gecos; char *pw_dir; char *pw_shell; }; struct passwd *getpwent(), *getpwuid(), *getpwnam(); The fields pwquota and pwcomment are unused; the others have meanings described in passwd(5). Getpwent reads the next line (opening the file if necessary); setpwent rewinds the file; endpwent closes it. Printed 5/12/88 1
GETPWENT(3C) COMMAND REFERENCE GETPWENT(3C) Getpwuid and getpwnam search from the beginning until a matching uid or name is found (or until EOF is encountered). FILES /etc/passwd DIAGNOSTICS Null pointer (0) returned on EOF or error. CAVEATS All information is contained in a static area so it must be copied if it is to be saved. SEE ALSO getlogin(3c), getgrent(3c), and passwd(5). Printed 5/12/88 2
%%index%% na:360,131; sy:491,1628; de:2119,1783;4334,302; fi:4636,92; di:4728,171; ca:4899,178; se:5077,218; %%index%%000000000132