diff --git a/build-in/exit/ft_exit_utils.c b/build-in/exit/ft_exit_utils.c index d1c3a7b..dbd697b 100644 --- a/build-in/exit/ft_exit_utils.c +++ b/build-in/exit/ft_exit_utils.c @@ -6,7 +6,7 @@ /* By: yuocak +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/08/03 14:30:31 by yuocak #+# #+# */ -/* Updated: 2025/08/05 12:37:09 by yuocak ### ########.fr */ +/* Updated: 2025/08/05 14:24:51 by yuocak ### ########.fr */ /* */ /* ************************************************************************** */ @@ -40,8 +40,7 @@ int is_numeric(char *str) i = 0; sign = 1; - while (str[i] && (str[i] == ' ' || str[i] == '\t' || str[i] == '\n' || - str[i] == '\r' || str[i] == '\f' || str[i] == '\v')) + while (str[i] && ft_isspace(str[i])) i++; if (str[i] == '-' || str[i] == '+') { diff --git a/execute/execute_external.c b/execute/execute_external.c index dc43a6b..2e7ad43 100644 --- a/execute/execute_external.c +++ b/execute/execute_external.c @@ -6,11 +6,12 @@ /* By: yuocak +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/07/07 07:45:00 by yuocak #+# #+# */ -/* Updated: 2025/08/04 10:36:42 by yuocak ### ########.fr */ +/* Updated: 2025/08/05 15:24:48 by yuocak ### ########.fr */ /* */ /* ************************************************************************** */ #include "../minishell.h" +#include static void cleanup_execution(t_exec_params *params) { @@ -24,8 +25,15 @@ static void cleanup_execution(t_exec_params *params) static void child_process(t_exec_params *params) { + struct stat st; + setup_child_signals(); execve(params->command_path, params->argv, params->envp); + if (stat(params->command_path, &st) == 0 && S_ISDIR(st.st_mode)) + { + printf("minishell: %s: Is a directory\n", params->command_path); + exit(126); + } perror("minishell"); exit(126); } diff --git a/execute/execute_multiple_utils2.c b/execute/execute_multiple_utils2.c index ccf893c..ad3a160 100644 --- a/execute/execute_multiple_utils2.c +++ b/execute/execute_multiple_utils2.c @@ -6,13 +6,14 @@ /* By: yuocak +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/07/24 13:00:00 by yuocak #+# #+# */ -/* Updated: 2025/08/05 13:23:17 by yuocak ### ########.fr */ +/* Updated: 2025/08/05 14:20:34 by yuocak ### ########.fr */ /* */ /* ************************************************************************** */ #include "../minishell.h" -static void assign_new_command(t_token **current, t_token **commands, int *cmd_index) +static void assign_new_command(t_token **current, t_token **commands, + int *cmd_index) { t_token *temp; @@ -23,7 +24,6 @@ static void assign_new_command(t_token **current, t_token **commands, int *cmd_i *current = temp; } - t_token **split_commands(t_token *token, int cmd_count) { t_token **commands;