From 11b258841f4a15c514c49af7d378b51cd6a8ab79 Mon Sep 17 00:00:00 2001 From: Charles Date: Tue, 23 Jun 2020 09:09:17 +0200 Subject: Fixing builtin which needed to not be run in a child process, Added exit builtin --- include/eval.h | 4 ++-- include/lexer.h | 3 ++- include/minishell.h | 9 +++++---- 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/eval.h b/include/eval.h index 97c1ce8..e300644 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/19 12:18:42 by charles ### ########.fr */ +/* Updated: 2020/06/23 08:33:02 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -35,7 +35,7 @@ typedef struct char *exec_path; char **argv; t_env env; - t_builtin_func builtin; + t_builtin_entry *builtin; } t_fork_param_cmd; # define MS_NO_FD -2 diff --git a/include/lexer.h b/include/lexer.h index df05c20..b5df79f 100644 --- a/include/lexer.h +++ b/include/lexer.h @@ -6,7 +6,7 @@ /* By: nahaddac +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/06/19 10:51:26 by nahaddac #+# #+# */ -/* Updated: 2020/06/19 10:51:30 by nahaddac ### ########.fr */ +/* Updated: 2020/06/23 08:55:53 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -54,6 +54,7 @@ int lexer_verif_entre_cote(char *input, int i); int lexe_space(char *input); t_token *token_new(enum e_token_tag tag, char *content); +t_token *token_new_until(enum e_token_tag tag, char *content, int n); void token_destroy(t_token *token); void token_destroy_lst(t_ftlst *tokens); void token_destroy_lst2(t_ftlst *tokens1, t_ftlst *tokens2); diff --git a/include/minishell.h b/include/minishell.h index 5f4f56a..f2b237f 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/18 13:45:27 by charles ### ########.fr */ +/* Updated: 2020/06/23 08:32:46 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -79,13 +79,14 @@ typedef int (*t_builtin_func)(char **argv, t_env env); ** \param func Associated function */ -struct s_builtin_entry +typedef struct { char *name; t_builtin_func func; -}; + bool child_process; +} t_builtin_entry; -t_builtin_func builtin_search_func(char *name); +t_builtin_entry *builtin_search_func(char *name); int builtin_echo(char **argv, t_env env); int builtin_cd(char **argv, t_env env); -- cgit