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

Go to the source code of this file.

Functions

char ** copy_toks (t_data *data, t_command *command)
 Creates a copy of all tokens that are in a command structure It's used for forks during exec.
 
int prepare_command (t_data *data)
 Prepare the command for search_command()
 
int prepare_command_forks (t_data *data)
 
int search_command (t_data *data, t_command *command, char **tokens)
 Search if command is a builtin or not.
 
int not_builtins (t_data *data, t_command *command, char **tokens)
 Executes commands that are not builtins.
 
int handle_redirections (t_garbage *garbage, t_command *command, int fd_backup[2])
 Create and redirect inputs and outputs needed for the command.
 
void reset_redirection (t_garbage *garbage, t_command *command, int fd_backup[2], unsigned char i)
 Reset redirections by default values Replace the new redirections by stdin and stdout.
 
int needs_to_be_forked (t_command *command)
 Check if it needs to be forked.
 
int execve_fork (t_data *data, char *path, char **toks, char **envp)
 
int handle_redirections_forks (t_garbage *garbage, t_command *command)
 Create and redirect inputs and outputs needed for the command.
 
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.