From 29e1af2b65d097e533189db4e7d5e20534c17b35 Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 14 Jul 2020 10:04:44 +0200 Subject: Refactoring error handling during parsing --- include/minishell.h | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'include/minishell.h') diff --git a/include/minishell.h b/include/minishell.h index f2b237f..9405109 100644 --- a/include/minishell.h +++ b/include/minishell.h @@ -6,7 +6,7 @@ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/26 15:33:51 by cacharle #+# #+# */ -/* Updated: 2020/06/23 08:32:46 by charles ### ########.fr */ +/* Updated: 2020/07/14 09:35:14 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -47,6 +47,8 @@ typedef t_ftht* t_path; typedef t_ftvec* t_env; +extern int g_last_status_code; + /* ** path.c */ @@ -103,4 +105,27 @@ int builtin_exit(char **argv, t_env env); char **preprocess(t_ftlst **tokens, t_env env); char *preprocess_filename(t_ftlst **tokens, t_env env); +/* +** error.c +*/ + +enum e_error +{ + ERROR_AMBIGUOUS_REDIR, + ERROR_OPEN, + ERROR_CMD_NOT_FOUND, + ERROR_SYNTAX, + ERROR_CMD_FOUND_ERROR, +}; + +typedef struct +{ + enum e_error id; + int status; + char *msg; // if NULL call strerror + // char basename; +} t_error; + +void error_eval_put(enum e_error id, char *unexpected); + #endif -- cgit