From ff13c21d378dcc459e0147eeb9144199d1ce84c7 Mon Sep 17 00:00:00 2001 From: gwojda Date: Wed, 8 Mar 2017 11:50:57 +0100 Subject: [PATCH] oups, c'etait pas dans le bon dossier --- 42sh/src/init_history.c | 37 ---------------------------------- 42sh/src/init_line.c | 44 ----------------------------------------- 42sh/test | 16 ++++++--------- 3 files changed, 6 insertions(+), 91 deletions(-) delete mode 100644 42sh/src/init_history.c delete mode 100644 42sh/src/init_line.c diff --git a/42sh/src/init_history.c b/42sh/src/init_history.c deleted file mode 100644 index c0be9d22..00000000 --- a/42sh/src/init_history.c +++ /dev/null @@ -1,37 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* init_history.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: gwojda +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2017/03/07 17:34:23 by gwojda #+# #+# */ -/* Updated: 2017/03/07 17:34:35 by gwojda ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "minishell.h" - -void ft_init_history(void) -{ - int fd; - char *str; - char *home; - char *path; - - if (!(home = ft_getenv(data_singleton()->env, "HOME"))) - return ; - path = ft_str3join(home, "/", ".42sh_history"); - fd = open(path, O_RDONLY); - if (fd == -1) - return ; - while (get_next_line(fd, &str) > 0) - { - ft_push_back_history(&data_singleton()->line.list_beg, - ft_create_history_list(str)); - free(str); - } - free(path); - free(str); - close(fd); -} diff --git a/42sh/src/init_line.c b/42sh/src/init_line.c deleted file mode 100644 index 07862a71..00000000 --- a/42sh/src/init_line.c +++ /dev/null @@ -1,44 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* init_line.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: gwojda +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2017/03/07 17:34:44 by gwojda #+# #+# */ -/* Updated: 2017/03/07 17:35:09 by gwojda ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "minishell.h" - -void ft_init_line(void) -{ - data_singleton()->line.input = NULL; - data_singleton()->line.copy_tmp = NULL; - data_singleton()->line.pos = 0; - data_singleton()->line.prompt_size = 0; - data_singleton()->line.list_size = 0; - data_singleton()->line.list_end = NULL; - data_singleton()->line.list_beg = NULL; - data_singleton()->line.opt = 0; -} - -void readline_init(char *prompt) -{ - static int beg = 0; - - if (!beg) - { - ft_init_line(); - ft_init_history(); - ft_save_termios(1); - beg = 1; - } - ft_init_termios(); - if (STR) - ft_strdel(&STR); - data_singleton()->line.list_cur = data_singleton()->line.list_beg; - POS = 0; - prompt ? ft_putstr(prompt) : ft_prompt(); -} diff --git a/42sh/test b/42sh/test index c5a4516a..148702e1 100644 --- a/42sh/test +++ b/42sh/test @@ -1,14 +1,10 @@  main.c 86   main.c 86   shell_init.c 27 interactive shell settings + token_print.c 29 11:[]  token_print.c 29 13:[ls] - token_print.c 29 13:[ls] - token_print.c 29 13:[ls] - token_print.c 29 13:[ls] - token_print.c 29 13:[cd] - token_print.c 29 13:[cd] - token_print.c 29 13:[-] - token_print.c 29 13:[cd] - token_print.c 29 13:[includes] - token_print.c 29 13:[cd] - token_print.c 29 13:[-] + token_print.c 29 06:[] + token_print.c 29 12:[] + ; + +----+----+ + COM OTHER