getpwnam

Accesses user-name information in the user database.

Format

#include  <pwd.h>

struct passwd *getpwnam  (const char name);

Arguments

name
The name of the user for which the attributes are to be read.

Description

This function returns the first user entry in the database with the pw_name member of the passwd structure that matches the name argument.

The passwd structure is defined in the <pwd.h> header file as follows:
pw_name  The user's login name. 
pw_uid  The numerical user ID. 
pw_gid  The numerical group ID. 
pw_dir  The home directory of the user. 
pw_shell  The initial program for the user. 


Note
All information generated by the getpwnam function is stored in a static area and is overwritten on subsequent calls to the function.

Return Values
A pointer to a valid password structure. 
NULL  An error occurred. errno is set to indicate the error. 


Previous Page | Next Page | Table of Contents | Index