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

The file containing the set builtin. More...

Functions

int display_variable (mysh_t *mysh)
 Print the list of variable if only one argument.
 
void add_variable (mysh_t *mysh, char *name, char *value)
 Add a variable to the list.
 
int exec_set (mysh_t *mysh)
 The set builtin.
 
char * get_variable_value (mysh_t *mysh, char *name)
 Get the value of a variable.
 

Detailed Description

The file containing the set builtin.

Function Documentation

◆ add_variable()

void add_variable ( mysh_t * mysh,
char * name,
char * value )

Add a variable to the list.

Parameters
myshThe shell structure
nameThe name of the variable
valueThe value of the variable
Returns
void

◆ display_variable()

int display_variable ( mysh_t * mysh)

Print the list of variable if only one argument.

Parameters
myshThe shell structure
Returns
int 1 if we print the variables, 0 otherwise

◆ exec_set()

int exec_set ( mysh_t * mysh)

The set builtin.

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

◆ get_variable_value()

char * get_variable_value ( mysh_t * mysh,
char * name )

Get the value of a variable.

Parameters
myshThe shell structure
nameThe name of the variable
Returns
char * The value of the variable