From cccd4692fab390d0c4fbab3fcae7f4aa55ca9f1a Mon Sep 17 00:00:00 2001 From: Charles Cabergs Date: Sat, 10 Oct 2020 11:43:05 +0200 Subject: Added comment to preprocess, redir, setup, signal, eval_cmd and utils --- src/eval/cmd.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/eval/cmd.c') diff --git a/src/eval/cmd.c b/src/eval/cmd.c index a35a73d..d107ce2 100644 --- a/src/eval/cmd.c +++ b/src/eval/cmd.c @@ -6,7 +6,7 @@ /* By: charles +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/06/14 10:41:31 by charles #+# #+# */ -/* Updated: 2020/10/09 14:31:45 by cacharle ### ########.fr */ +/* Updated: 2020/10/10 11:32:36 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,6 +14,14 @@ pid_t g_child_pid = -1; +/* +** \brief Function wrapped in fork_wrap. +** If it's a builtin, call the coresponding builtin function +** Otherwise call execve +** \param param Parameters of this function +** \return The status of the builtin or the error code of execve +*/ + static int st_wrapped_cmd(t_fork_param_cmd *param) { int status; @@ -36,6 +44,15 @@ static int st_split_destroy_ret(int ret, char **strs) return (ret); } +/* +** \brief Evaluate a command +** \param fds Input/output file descriptor of the command +** \param env Environment +** \param ast Comment AST node +** \return EVAL_FATAL no allocation error, +** the status of the runned command otherwise +*/ + int eval_cmd(int fds[2], t_env env, t_ast *ast) { t_fork_param_cmd param; -- cgit