diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-02-28 09:41:52 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-02-28 12:38:58 +0100 |
| commit | cc1b57c96cc8c0fdd53e781b54a83bb9c743179a (patch) | |
| tree | b58d43c6fc5b3b57cdeb28f9a21f421d3400196c /src/main.c | |
| parent | 83e7d63bc9c2d4a246df3cc8555127f3b956f960 (diff) | |
| download | minishell-cc1b57c96cc8c0fdd53e781b54a83bb9c743179a.tar.gz minishell-cc1b57c96cc8c0fdd53e781b54a83bb9c743179a.tar.bz2 minishell-cc1b57c96cc8c0fdd53e781b54a83bb9c743179a.zip | |
Added environment and state
Also dummy files eval.c parse.c
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 41 |
1 files changed, 25 insertions, 16 deletions
@@ -1,24 +1,33 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* main.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* 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); } |
