From 11a719bab26b3ccccbd219decab2d0cf77021004 Mon Sep 17 00:00:00 2001 From: Charles Date: Mon, 15 Jun 2020 12:39:56 +0200 Subject: Refactoring redirection out of eval/cmd.c, Added tag check shortcut --- include/eval.h | 12 ++++++++++-- include/lexer.h | 5 +++++ 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/eval.h b/include/eval.h index 3ba7527..f834d45 100644 --- a/include/eval.h +++ b/include/eval.h @@ -6,7 +6,7 @@ /* By: charles +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/01 17:05:30 by charles #+# #+# */ -/* Updated: 2020/06/15 10:31:06 by charles ### ########.fr */ +/* Updated: 2020/06/15 11:09:49 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -57,6 +57,8 @@ typedef struct t_builtin_func builtin; } t_fork_param_cmd; +#define MS_NO_FD -2 + /* ** eval.c */ @@ -97,6 +99,12 @@ void error_eval_put(enum e_error id, char *unexpected); ** cmd.c */ -int eval_cmd(t_env env, t_path path, t_ast *ast); +int eval_cmd(t_env env, t_path path, t_ast *ast); + +/* +** redir.c +*/ + +bool redir_extract(t_ftlst *redirs, t_env env, int *fd_in, int *fd_out); #endif diff --git a/include/lexer.h b/include/lexer.h index e2abe28..3acffb0 100644 --- a/include/lexer.h +++ b/include/lexer.h @@ -21,6 +21,9 @@ enum e_token_tag TAG_STR_DOUBLE = 1 << 10, TAG_STR_SINGLE = 1 << 11, TAG_STICK = 1 << 12, + + TAG_IS_STR = TAG_STR | TAG_STR_SINGLE | TAG_STR_DOUBLE, + TAG_IS_REDIR = TAG_REDIR_IN | TAG_REDIR_OUT | TAG_REDIR_APPEND, }; typedef struct @@ -39,5 +42,7 @@ int lexe_space(char *input); t_token *token_new(enum e_token_tag tag, char *content); void token_destroy(t_token *token); +void token_destroy_lst(t_ftlst *tokens); +void token_destroy_lst2(t_ftlst *tokens1, t_ftlst *tokens2); #endif -- cgit