minishell
Minishell Project for École 42
|
Command Execution Functions. More...
#include "minishell.h"
Functions | |
void | close_fds (t_executor *current) |
Close file descriptors based on command redirection settings. | |
void | handle_single (t_shell *shell) |
Handle the execution of a single command. | |
void | executor (t_shell *shell) |
Primary entrypoint of command execution. | |
Command Execution Functions.
void close_fds | ( | t_executor * | current | ) |
Close file descriptors based on command redirection settings.
This function is responsible for closing file descriptors associated with input and output redirection, as determined by the settings in the current executor node.
[in] | current | A pointer to the executor struct. |
void executor | ( | t_shell * | shell | ) |
Primary entrypoint of command execution.
The executor function determines whether to handle a single command or multiple command based on the size of commands passed to it.
[in,out] | shell | A pointer to the shell struct. |
void handle_single | ( | t_shell * | shell | ) |
Handle the execution of a single command.
The handle_single function first checks if the command is an empty string and fails accordingly. If the command is a builtin it would execute it in the parent process, otherwise it would do a fork and execute the external command in the child process.
[in,out] | shell | A pointer to the shell struct. |