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.

## 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.

## Macro Definition Documentation

## USERNAME_MAX

#define USERNAME_MAX 256

The maximum size of a user name.

## Function Documentation

## username_is_super()

int username_is_super | ( |  | ) |

Determine if the current user is the super user.

Returns
  True if the current user is root, false otherwise.

## username_get()

int username_get | ( | char * | name | ) |

Get the name of the current user.

Parameters

  name | A string of USERNAME_MAX bytes to hold the username.

Returns
  True if the username could be found, false otherwise.

## username_set()

int username_set | ( | const char * | name | ) |

Switch to the named user.

Parameters

  name | The name of the user to change privilege to.

Returns
  True if the privilege could be changed, false otherwise.

## username_home()

int username_home | ( | char * | dir | ) |

Get the current user's home directory.

Parameters

  dir | A string to hold the home directory.

Returns
  True if the home directory could be found, false otherwise.