minishell
Minishell Project for École 42
|
Single builtin-command Execution Functions. More...
#include "minishell.h"
Functions | |
bool | is_builtin (char *exec) |
Check if a given command is a builtin-command. | |
void | execute_builtin (t_shell *shell) |
Execute a builtin-command. | |
int | handle_single_builtin (t_shell *shell) |
Handle the execution of a single builtin-command. | |
Single builtin-command Execution Functions.
This file contains functions responsible for executing builtin-commands within the project. It includes functions to identify builtins, execute them, and handle single builtin commands.
void execute_builtin | ( | t_shell * | shell | ) |
Execute a builtin-command.
The execute_builtin function executes the appropriate builtin-command based on the provided command name in the execs array. It sets the global g_exit_code variable to the exit status of the command.
[in,out] | shell | A pointer to the shell struct. |
int handle_single_builtin | ( | t_shell * | shell | ) |
Handle the execution of a single builtin-command.
The handle_single_builtin function checks if the provided command is a builtin, saves the file descriptors, handles standard input and output redirections, executes the builtin-command and restores standard file descriptors.
[in,out] | shell | A pointer to the shell struct. |
bool is_builtin | ( | char * | exec | ) |
Check if a given command is a builtin-command.
This function determines whether the provided command is one of the shell builtin-commands such as "echo", "cd", "pwd", "export", "unset", "env" or "exit."
[in] | exec | The command name to check. |