aboutsummaryrefslogtreecommitdiff
path: root/src/eval/cmd.c
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-10-10 11:43:05 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-10-10 11:43:05 +0200
commitcccd4692fab390d0c4fbab3fcae7f4aa55ca9f1a (patch)
tree935f8aa5b19c780bdd7dbd7581dd067bad7b1eeb /src/eval/cmd.c
parent5b681182824ae45b5a27d1503de32fa2760c5800 (diff)
downloadminishell-cccd4692fab390d0c4fbab3fcae7f4aa55ca9f1a.tar.gz
minishell-cccd4692fab390d0c4fbab3fcae7f4aa55ca9f1a.tar.bz2
minishell-cccd4692fab390d0c4fbab3fcae7f4aa55ca9f1a.zip
Added comment to preprocess, redir, setup, signal, eval_cmd and utils
Diffstat (limited to 'src/eval/cmd.c')
-rw-r--r--src/eval/cmd.c19
1 files changed, 18 insertions, 1 deletions
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 <charles@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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;