From 6e456095fce214a2eadea0cafa3fa7ea1113b4e6 Mon Sep 17 00:00:00 2001 From: Charles Date: Sun, 19 Jul 2020 19:27:52 +0200 Subject: Added errof for cleaner error message, Removed previous error functions --- include/minishell.h | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) (limited to 'include') diff --git a/include/minishell.h b/include/minishell.h index 3406041..fe05b7e 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/07/17 11:17:16 by charles ### ########.fr */ +/* Updated: 2020/07/19 19:24:06 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -28,6 +28,7 @@ # include # include # include +# include # include "libft.h" # include "libft_ht.h" @@ -113,31 +114,17 @@ char *preprocess_filename(t_ftlst **tokens, t_env env); ** error.c */ -enum e_error +typedef enum { - ERROR_AMBIGUOUS_REDIR, - ERROR_OPEN, - ERROR_CMD_NOT_FOUND, - ERROR_SYNTAX, - ERROR_CMD_FOUND_ERROR, -}; - -/* -** \brief Error specification -** \param id Error type -** \param status Status code returned -** \param msg Error message to print, if is NULL, use strerror as a msg -*/ - -typedef struct -{ - enum e_error id; - int status; - char *msg; -} t_error; - -void error_eval_put(enum e_error id, char *content); -void error_put_invalid_identifier(char *prefix, char *identifier); + ERR_FATAL = -1, + ERR_NONE = 0, + ERR_AMBIGUOUS_REDIR = 1, + ERR_OPEN = 1, + ERR_CMD_NOT_FOUND = 127, + ERR_SYNTAX = 2, +} t_err; + +void errorf(const char *format, ...); /* ** signal.c -- cgit