From cc1b57c96cc8c0fdd53e781b54a83bb9c743179a Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 28 Feb 2020 09:41:52 +0100 Subject: Added environment and state Also dummy files eval.c parse.c --- src/main.c | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index d4c6729..020b5e7 100644 --- a/src/main.c +++ b/src/main.c @@ -1,24 +1,33 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/28 11:45:44 by cacharle #+# #+# */ +/* Updated: 2020/02/28 11:50:29 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + #include "minishell.h" int main(int argc, char **argv, char **envp) { + t_state state; + char *line; + int ret; - (void)argc; - (void)argv; - (void)envp; - // init - // find executable in PATH - - // user_loop - // get user input - // parse input - // if error: - // continue - // interpret command - // waiting for process to end + if (ms_state_init(&state, envp) == -1) + return (1); - // destroy - - + while ((ret = ft_next_line(STDIN_FILENO, &line)) == 1) + { + if (ms_eval(ms_parse(line)) == -1) + continue ; // and display error + free(line); + } + free(line); + ms_state_destroy(&state); return (0); } -- cgit