42sh 1.0.0
Create a shell in C
Loading...
Searching...
No Matches
setenv.c File Reference

The file containing the history builtins. More...

Functions

int my_str_is_valid (char const *str)
 Check if a string is valid to be an environment variable.
 
int set_new_env_var (mysh_t *mysh, char *var, char *value)
 Set a new environment variable.
 
int exec_setenv (mysh_t *mysh)
 The setenv builtin.
 

Detailed Description

The file containing the history builtins.

The file containing the setenv builtin.

Function Documentation

◆ exec_setenv()

int exec_setenv ( mysh_t * mysh)

The setenv builtin.

Parameters
myshThe shell structure
Returns
int 0 if the command succeed, 1 otherwise

◆ my_str_is_valid()

int my_str_is_valid ( char const * str)

Check if a string is valid to be an environment variable.

Parameters
strThe string to check
Returns
int 1 if the string is valid, 0 otherwise

◆ set_new_env_var()

int set_new_env_var ( mysh_t * mysh,
char * var,
char * value )

Set a new environment variable.

Parameters
myshThe shell structure
varThe variable name
valueThe variable value
Returns
int 0 if the command succeed, 1 otherwise