Minishell
 
Loading...
Searching...
No Matches
Exec Utils

Functions used in exec that are simple utils. More...

Functions

size_t count_commands (t_command *command)
 Cound the number of commands in the command structure.
 
int safe_close (int *fd)
 Safely close fd.
 
void dup_and_close (t_garbage *garbage, int oldfd, int newfd)
 Special dup2 that also closes the old fd.
 
void execute_pipeline (t_data *data, pid_t *pids, size_t *count)
 Execute all the command that are followed by pipes.
 
void fill_toks_into_commands (t_data *data, t_command *command)
 
void search_path (t_data *data, t_command *command)
 Search path for the designated command.
 
void search_paths (t_data *data, t_command *command)
 Search Path for all commands.
 
void wait_all_childs (t_command *command, pid_t *pids)
 Waits for all the childs with their pids.
 

Detailed Description

Functions used in exec that are simple utils.

Function Documentation

◆ count_commands()

size_t count_commands ( t_command * command)

Cound the number of commands in the command structure.

Parameters
commandcommand structure
Returns
size_t number of commands

◆ dup_and_close()

void dup_and_close ( t_garbage * garbage,
int oldfd,
int newfd )

Special dup2 that also closes the old fd.

Parameters
garbagegarbage structure
oldfdfd that will overwrite newfd and will be close
newfdfd to overwrite by oldfd
Here is the call graph for this function:

◆ execute_pipeline()

void execute_pipeline ( t_data * data,
pid_t * pids,
size_t * count )

Execute all the command that are followed by pipes.

Parameters
datadata structure
pidsarray of pids of childs
countpointer to count the number of commands
Here is the call graph for this function:

◆ fill_toks_into_commands()

void fill_toks_into_commands ( t_data * data,
t_command * command )
Here is the call graph for this function:

◆ safe_close()

int safe_close ( int * fd)

Safely close fd.

Parameters
fdfile descriptor to close
Returns
0 no error, 1 ERROR

◆ search_path()

void search_path ( t_data * data,
t_command * command )

Search path for the designated command.

Parameters
datadata structure
commandcommand structure
Here is the call graph for this function:

◆ search_paths()

void search_paths ( t_data * data,
t_command * command )

Search Path for all commands.

Parameters
datadata structure
commandcommand structure
Here is the call graph for this function:

◆ wait_all_childs()

void wait_all_childs ( t_command * command,
pid_t * pids )

Waits for all the childs with their pids.

Parameters
commandcommand structure
pidsarray of pids of childs
Here is the call graph for this function: