diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-10-10 13:04:20 +0200 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-10-10 13:04:20 +0200 |
| commit | f5579768b8e27dbba16101dc3295927c15b36a1a (patch) | |
| tree | edfdaae3d0c16de4d3412148869f5d5d3c71f420 /src/eval/operation.c | |
| parent | cccd4692fab390d0c4fbab3fcae7f4aa55ca9f1a (diff) | |
| download | minishell-f5579768b8e27dbba16101dc3295927c15b36a1a.tar.gz minishell-f5579768b8e27dbba16101dc3295927c15b36a1a.tar.bz2 minishell-f5579768b8e27dbba16101dc3295927c15b36a1a.zip | |
Fixing signal last status code
Diffstat (limited to 'src/eval/operation.c')
| -rw-r--r-- | src/eval/operation.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/eval/operation.c b/src/eval/operation.c index 826727a..3b6275a 100644 --- a/src/eval/operation.c +++ b/src/eval/operation.c @@ -6,12 +6,21 @@ /* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/06/17 15:27:22 by charles #+# #+# */ -/* Updated: 2020/10/09 20:39:33 by charles ### ########.fr */ +/* Updated: 2020/10/10 13:01:56 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ #include "eval.h" +/* +** \brief Evaluate an operation &&/||/; +** \param fds Input/output filedescriptor +** \param env Environment +** \param ast Operation AST node +** \return Status code of the left hand side if short circuit, +** stat code of the right hand side otherwise. +*/ + int eval_operation(int fds[2], t_env env, t_ast *ast) { int status; @@ -24,9 +33,9 @@ int eval_operation(int fds[2], t_env env, t_ast *ast) right_fds[FD_WRITE] = fds[FD_WRITE]; if ((status = eval(left_fds, env, ast->op.left)) == EVAL_FATAL) return (EVAL_FATAL); - g_state.last_status = status; if (g_state.killed) return (status); + g_state.last_status = status; if ((ast->op.sep == TAG_AND && status != 0) || (ast->op.sep == TAG_OR && status == 0)) return (status); @@ -62,6 +71,13 @@ static int st_run_piped( return (pid); } +/* +** \brief Evaluate a pipeline +** \param env Environment +** \param ast Pipeline AST node +** \return Status of the last command in the pipeline +*/ + int eval_pipeline(t_env env, t_ast *ast) { t_ftlst *curr; |
