diff --git a/src/executer/execute_built_in.c b/src/executer/execute_built_in.c index d32edfb..e120bb0 100644 --- a/src/executer/execute_built_in.c +++ b/src/executer/execute_built_in.c @@ -1,5 +1,38 @@ +/* ************************************************************************** */ +/* */ +/* :::::::: */ +/* execute_built_in.c :+: :+: */ +/* +:+ */ +/* By: spanfilo +#+ */ +/* +#+ */ +/* Created: 2025/05/08 11:51:23 by spanfilo #+# #+# */ +/* Updated: 2025/05/08 11:56:35 by spanfilo ######## odam.nl */ +/* */ +/* ************************************************************************** */ + #include "executer.h" +int is_builtin_cmd(char **command_args) +{ + if (!command_args[0]) + return(0); + if (ft_strncmp(command_args[0],"export", 7) == 0) + return (1); + if (ft_strncmp(command_args[0],"env", 4) == 0) + return (1); + if (ft_strncmp(command_args[0],"unset", 6) == 0) + return (1); + if (ft_strncmp(command_args[0],"exit", 5) == 0) + return (1); + if (ft_strncmp(command_args[0],"cd", 3) == 0) + return (1); + if (ft_strncmp(command_args[0],"echo", 5) == 0) + return (1); + if (ft_strncmp(command_args[0],"pwd", 4) == 0) + return (1); + return (0); +} + void execute_builtin(char **command_args, t_minishell *mshell, int *exit_status) { if (ft_strncmp(command_args[0], "export", 7) == 0) @@ -16,4 +49,4 @@ void execute_builtin(char **command_args, t_minishell *mshell, int *exit_status) exec_pwd(command_args, mshell); else if (ft_strncmp(command_args[0],"echo", 5) == 0) exec_echo(command_args, mshell); -} \ No newline at end of file +} diff --git a/src/executer/executer.c b/src/executer/executer.c index 989191e..93a38e0 100644 --- a/src/executer/executer.c +++ b/src/executer/executer.c @@ -6,6 +6,7 @@ /* By: sveta +#+ */ /* +#+ */ /* Created: 2025/03/06 13:52:31 by sveta #+# #+# */ +/* Updated: 2025/05/08 12:09:08 by spanfilo ######## odam.nl */ /* Updated: 2025/05/07 20:40:17 by sveta ######## odam.nl */ /* */ /* ************************************************************************** */ @@ -29,24 +30,6 @@ int get_nbr_cmds(t_minishell *mshell) return (nbr_cmds); } -int is_builtin_cmd(char **command_args) -{ - if (!command_args[0]) - return(0); - if (ft_strncmp(command_args[0],"export", 7) == 0) - return (1); - if (ft_strncmp(command_args[0],"env", 4) == 0) - return (1); - if (ft_strncmp(command_args[0],"unset", 6) == 0) - return (1); - if (ft_strncmp(command_args[0],"exit", 5) == 0) - return (1); - if (ft_strncmp(command_args[0],"cd", 3) == 0) - return (1); - if (ft_strncmp(command_args[0],"echo", 5) == 0) - return (1); - return (0); -} void execute_commands(t_minishell *mshell, int *exit_status) {