cctools
Defines | Functions
username.h File Reference

Obtain information about the current user. More...

Go to the source code of this file.

Defines

#define USERNAME_MAX   256
 The maximum size of a user name.

Functions

int username_is_super ()
 Determine if the current user is the super user.
int username_get (char *name)
 Get the name of the current user.
int username_set (const char *name)
 Switch to the named user.
int username_home (char *dir)
 Get the current user's home directory.

Detailed Description

Obtain information about the current user.


Define Documentation

#define USERNAME_MAX   256

The maximum size of a user name.


Function Documentation

int username_is_super ( )

Determine if the current user is the super user.

Returns:
True if the current user is root, false otherwise.
int username_get ( char *  name)

Get the name of the current user.

Parameters:
nameA string of USERNAME_MAX bytes to hold the username.
Returns:
True if the username could be found, false otherwise.
int username_set ( const char *  name)

Switch to the named user.

Parameters:
nameThe name of the user to change privilege to.
Returns:
True if the privilege could be changed, false otherwise.
int username_home ( char *  dir)

Get the current user's home directory.

Parameters:
dirA string to hold the home directory.
Returns:
True if the home directory could be found, false otherwise.