minishell
Minishell Project for École 42
|
Builtin function for the exit command. More...
#include "minishell.h"
Functions | |
bool | is_arg_number (char *arg) |
Checks if a string represents a valid numeric argument. | |
int | exit_builtin (t_shell *shell, char **args, bool in_child) |
Handles the exit command when executed in a child process. | |
Builtin function for the exit command.
This file contains the implementation of the exit builtin command The exit command is used to terminate the shell and optionally specify an exit status.
int exit_builtin | ( | t_shell * | shell, |
char ** | args, | ||
bool | in_child | ||
) |
Handles the exit command when executed in a child process.
This function is called when the exit command is executed within a child process. It handles the termination of the child process based on the provided arguments.
[in] | shell | A pointer to the shell struct. |
[in] | args | An array of strings containing the arguments. |
[in] | in_child | A boolean indicating whether the function is called in a child process. |
bool is_arg_number | ( | char * | arg | ) |
Checks if a string represents a valid numeric argument.
This function is used to determine if a string can be interpreted as a valid numeric argument for the exit command. It checks whether all characters in the string are digits. Skips the first '-' or '+'.
[in] | arg | The string to be checked. |