struct passwd
{
char * pw_name; /* Username, POSIX.1 */
char * pw_passwd; /* Password */
__uid_t pw_uid; /* User ID, POSIX.1 */
__gid_t pw_gid; /* Group ID, POSIX.1 */
char * pw_gecos; /* Real Name or Comment field */
char * pw_dir; /* Home directory, POSIX.1 */
char * pw_shell; /* Shell Program, POSIX.1 */
};
#include <pwd.h>
#include <string.h>
#include <stddef.h>
struct passwd *getpwnam(const char *name)
{
struct passwd *ptr;
setpwent();
while((ptr = getpwent()))
if(strcmp(name,ptr->pw_name) == 0)
break;
endpwent();
return ptr;
}