minishell
Minishell Project for École 42
|
Functions related to handling multiple commands and their processes. More...
#include "minishell.h"
Functions | |
int | handle_pipes (int fildes[2]) |
Creates a pipe and sets the file descriptors in the given array. | |
pid_t | handle_forks (void) |
Creates a child process using fork() and returns the process ID. | |
int | parent_handler_multi (int *fildes, t_executor *current) |
Handles the parent process during multi-command execution. | |
int | handle_pipeline (int *fildes, t_executor *current, t_info *info, int i) |
Handles the execution of a pipeline of commands. | |
Functions related to handling multiple commands and their processes.
pid_t handle_forks | ( | void | ) |
Creates a child process using fork() and returns the process ID.
This function creates a child process using the fork() system call and returns the process ID for the child process.
int handle_pipeline | ( | int * | fildes, |
t_executor * | current, | ||
t_info * | info, | ||
int | i | ||
) |
Handles the execution of a pipeline of commands.
This function manages the execution of multiple commands, including creating pipes, forking child processes, calling child and parent handlers and handling error conditions.
fildes | Array of pipe file descriptors. |
current | The current node of the executor list representing a command. |
info | Pointer to the t_info structure. |
i | Index of the current command/child in the pipeline. |
int handle_pipes | ( | int | fildes[2] | ) |
Creates a pipe and sets the file descriptors in the given array.
This function creates a pipe using the provided file descriptor array and sets the appropriate file descriptors for communication between commands.
fildes | Array to store pipe file descriptors. |
int parent_handler_multi | ( | int * | fildes, |
t_executor * | current | ||
) |
Handles the parent process during multi-command execution.
This function manages file descriptors for input and output redirection. It manages the pipe for the parent process.
fildes | Array of pipe file descriptors. |
current | The current node of the executor list representing a command. |