aboutsummaryrefslogtreecommitdiff
path: root/src/eval
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-10-10 19:19:41 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-10-10 19:19:41 +0200
commit210fb08de6c5a9a5b0a7dd7deb737a75d9133b32 (patch)
tree20d217b12fd8bbacfaf1d63245e482cccda33916 /src/eval
parent4773be43fa4c9ad88c72c45e26e5ea304eac7a77 (diff)
downloadminishell-210fb08de6c5a9a5b0a7dd7deb737a75d9133b32.tar.gz
minishell-210fb08de6c5a9a5b0a7dd7deb737a75d9133b32.tar.bz2
minishell-210fb08de6c5a9a5b0a7dd7deb737a75d9133b32.zip
Added comment to parser
Diffstat (limited to 'src/eval')
-rw-r--r--src/eval/operation.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/eval/operation.c b/src/eval/operation.c
index 3b6275a..3df3c85 100644
--- a/src/eval/operation.c
+++ b/src/eval/operation.c
@@ -6,7 +6,7 @@
/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/06/17 15:27:22 by charles #+# #+# */
-/* Updated: 2020/10/10 13:01:56 by cacharle ### ########.fr */
+/* Updated: 2020/10/10 18:17:15 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -21,7 +21,7 @@
** stat code of the right hand side otherwise.
*/
-int eval_operation(int fds[2], t_env env, t_ast *ast)
+int eval_operation(int fds[2], t_env env, t_ast *ast)
{
int status;
int left_fds[2];
@@ -44,7 +44,20 @@ int eval_operation(int fds[2], t_env env, t_ast *ast)
#define PIPES_PREV_OUTPUT 2
-static int st_run_piped(
+/*
+** \brief Evaluate a piped expression (i.e command or parenthesis)
+** \param env Environment
+** \param ast AST of the expression to evaluate
+** \param pipes File descriptor to setup in the child
+** pipes[0] - read end
+** pipes[1] - write end
+** pipes[2] - output of the previous command
+** \param is_last Setup file dscriptors differently if
+** it's the last expression in the pipeline
+** \return pid of the child process
+*/
+
+static pid_t st_run_piped(
t_env env, t_ast *ast, int pipes[3], bool is_last)
{
pid_t pid;
@@ -78,7 +91,7 @@ static int st_run_piped(
** \return Status of the last command in the pipeline
*/
-int eval_pipeline(t_env env, t_ast *ast)
+int eval_pipeline(t_env env, t_ast *ast)
{
t_ftlst *curr;
int pipes[3];