aboutsummaryrefslogtreecommitdiff
path: root/src/eval
diff options
context:
space:
mode:
Diffstat (limited to 'src/eval')
-rw-r--r--src/eval/cmd.c6
-rw-r--r--src/eval/error.c55
2 files changed, 3 insertions, 58 deletions
diff --git a/src/eval/cmd.c b/src/eval/cmd.c
index b3cdc15..196d810 100644
--- a/src/eval/cmd.c
+++ b/src/eval/cmd.c
@@ -6,7 +6,7 @@
/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/06/14 10:41:31 by charles #+# #+# */
-/* Updated: 2020/07/14 11:07:00 by charles ### ########.fr */
+/* Updated: 2020/07/15 13:03:20 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -92,8 +92,8 @@ int eval_cmd(int fds[2], t_env env, t_path path, t_ast *ast)
return (-1); // return error status
}
}
- /* else if (!param.builtin->child_process) // solved with pipeline */
- /* return (param.builtin->func(argv, env)); */
+ else// solved with pipeline
+ return (param.builtin->func(argv, env));
param.argv = argv;
param.env = env;
diff --git a/src/eval/error.c b/src/eval/error.c
deleted file mode 100644
index 10f5740..0000000
--- a/src/eval/error.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* ************************************************************************** */
-/* */
-/* ::: :::::::: */
-/* error.c :+: :+: :+: */
-/* +:+ +:+ +:+ */
-/* By: charles <charles@student.42.fr> +#+ +:+ +#+ */
-/* +#+#+#+#+#+ +#+ */
-/* Created: 2020/06/14 11:02:52 by charles #+# #+# */
-/* Updated: 2020/07/14 11:10:12 by nahaddac ### ########.fr */
-/* */
-/* ************************************************************************** */
-
-#include "eval.h"
-
-static t_error g_errors[] =
-{
- {ERROR_AMBIGUOUS_REDIR, 1, "ambiguous redirect"},
- {ERROR_OPEN, 1, NULL},
- {ERROR_CMD_NOT_FOUND, 127, "command not found"},
-};
-
-t_error *st_error_get(enum e_error id)
-{
- size_t i;
- t_error *match;
-
- match = NULL;
- i = 0;
- while (i < sizeof(g_errors) / sizeof(t_error))
- {
- if (g_errors[i].id == id)
- match = &g_errors[i];
- i++;
- }
- return (match);
-}
-
-void error_eval_put(enum e_error id, char *unexpected)
-{
- t_error *err;
-
- err = st_error_get(id);
- ft_putstr_fd("minishell: ", STDERR_FILENO);
- ft_putstr_fd(unexpected, STDERR_FILENO);
- ft_putstr_fd(": ", STDERR_FILENO);
- if (err->msg == NULL)
- ft_putendl_fd(strerror(errno), STDERR_FILENO);
- else
- ft_putendl_fd(err->msg, STDERR_FILENO);
-}
-
-int error_status(enum e_error id)
-{
- return (st_error_get(id)->status);
-}