Minishell
Loading...
Searching...
No Matches
custom_commands.h File Reference
#include "main.h"
Include dependency graph for custom_commands.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void init_history (history_t *history)
 
void add_history (data_t *data)
 
int command_is_digit (const char *str)
 
char * read_history_utils (history_t *history, char *path)
 
char * get_path (data_t *data, history_t *history)
 
void up_down_command (data_t *data, bool up_direction, int *his_idx)
 
int my_cd (data_t *data, run_command_t *command)
 
int print_env (data_t *data)
 
void add_env (data_t *data, char *name, char *value)
 
int my_setenv (data_t *data, run_command_t *command)
 
int my_unsetenv (data_t *data, run_command_t *command)
 
int select_command (data_t *data, run_command_t *command)
 
env_node_tfind_env (data_t *data, char *name)
 
alias_tcreate_alias_node (const char *name, char **value)
 

Function Documentation

◆ add_env()

void add_env ( data_t * data,
char * name,
char * value )

◆ add_history()

void add_history ( data_t * data)

add the command to the history file

Parameters
data

◆ command_is_digit()

int command_is_digit ( const char * str)
Here is the call graph for this function:

◆ create_alias_node()

alias_t * create_alias_node ( const char * name,
char ** value )

◆ find_env()

env_node_t * find_env ( data_t * data,
char * name )
Here is the call graph for this function:

◆ get_path()

char * get_path ( data_t * data,
history_t * history )

get the path of the history file

Parameters
data
history
Here is the call graph for this function:

◆ init_history()

void init_history ( history_t * history)

◆ my_cd()

int my_cd ( data_t * data,
run_command_t * command )

◆ my_setenv()

int my_setenv ( data_t * data,
run_command_t * command )

◆ my_unsetenv()

int my_unsetenv ( data_t * data,
run_command_t * command )

◆ print_env()

int print_env ( data_t * data)

◆ read_history_utils()

char * read_history_utils ( history_t * history,
char * path )

get all the information of the history file into a string

Parameters
history
path

◆ select_command()

int select_command ( data_t * data,
run_command_t * command )
Parameters
dataGlobal data structure
commanditem on the linked list that contains the current command
Returns
84 if there was an error, 0 if everything is ok and 1 if not found

◆ up_down_command()

void up_down_command ( data_t * data,
bool up_direction,
int * his_idx )

Move cursor up or down by using arrow keys

Parameters
data
up_directionbool false if up/ true if down
his_idxindex of the history
Here is the call graph for this function: