libexplain  1.4.D001
Functions | Variables
libexplain/setenv_on_error.c File Reference
#include <libexplain/ac/errno.h>
#include <libexplain/ac/stdlib.h>
#include <libexplain/ac/string.h>
#include <libexplain/is_efault.h>
#include <libexplain/output.h>
#include <libexplain/setenv.h>

Go to the source code of this file.

Functions

static char * name_eq_value (const char *name, const char *value)
static int setenv (const char *name, const char *value, int overwrite)
int explain_setenv_on_error (const char *name, const char *value, int overwrite)

Variables

char ** environ

Function Documentation

int explain_setenv_on_error ( const char *  name,
const char *  value,
int  overwrite 
)

The explain_setenv_on_error function is used to call the setenv(3) system call. On failure an explanation will be printed to stderr, obtained from the explain_setenv(3) function.

Parameters:
nameThe name, exactly as to be passed to the setenv(3) system call.
valueThe value, exactly as to be passed to the setenv(3) system call.
overwriteThe overwrite, exactly as to be passed to the setenv(3) system call.
Returns:
The value returned by the wrapped setenv(3) system call.
Example:
This function is intended to be used in a fashion similar to the following example:
 if (explain_setenv_on_error(name, value, overwrite) < 0)
 {
     ...cope with error
     ...no need to print error message
 }

Definition at line 179 of file setenv_on_error.c.

static char* name_eq_value ( const char *  name,
const char *  value 
) [static]

Definition at line 34 of file setenv_on_error.c.

static int setenv ( const char *  name,
const char *  value,
int  overwrite 
) [static]

Definition at line 54 of file setenv_on_error.c.


Variable Documentation

char** environ