cctools
Macros | Functions
username.h File Reference

Obtain information about the current user. More...

Go to the source code of this file.

Macros

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

Functions

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

Detailed Description

Obtain information about the current user.

Macro Definition 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.