oups, c'etait pas dans le bon dossier

This commit is contained in:
gwojda 2017-03-08 11:50:57 +01:00
parent b4e7d8ab5e
commit ff13c21d37
3 changed files with 6 additions and 91 deletions

View file

@ -1,37 +0,0 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* init_history.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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);
}

View file

@ -1,44 +0,0 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* init_line.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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();
}

View file

@ -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