aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c41
1 files changed, 25 insertions, 16 deletions
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 <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);
}