oups, c'etait pas dans le bon dossier
This commit is contained in:
parent
b4e7d8ab5e
commit
ff13c21d37
3 changed files with 6 additions and 91 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
16
42sh/test
16
42sh/test
|
|
@ -1,14 +1,10 @@
|
|||
[7m[33m main.c [1m[34m86 [0m[0m
|
||||
[7m[33m main.c [1m[34m86 [0m[0m
|
||||
[7m[33m shell_init.c [1m[34m27 [0minteractive shell settings[0m
|
||||
[7m[33m token_print.c [1m[34m29 [0m11:[][0m
|
||||
[7m[33m token_print.c [1m[34m29 [0m13:[ls][0m
|
||||
[7m[33m token_print.c [1m[34m29 [0m13:[ls][0m
|
||||
[7m[33m token_print.c [1m[34m29 [0m13:[ls][0m
|
||||
[7m[33m token_print.c [1m[34m29 [0m13:[ls][0m
|
||||
[7m[33m token_print.c [1m[34m29 [0m13:[cd][0m
|
||||
[7m[33m token_print.c [1m[34m29 [0m13:[cd][0m
|
||||
[7m[33m token_print.c [1m[34m29 [0m13:[-][0m
|
||||
[7m[33m token_print.c [1m[34m29 [0m13:[cd][0m
|
||||
[7m[33m token_print.c [1m[34m29 [0m13:[includes][0m
|
||||
[7m[33m token_print.c [1m[34m29 [0m13:[cd][0m
|
||||
[7m[33m token_print.c [1m[34m29 [0m13:[-][0m
|
||||
[7m[33m token_print.c [1m[34m29 [0m06:[][0m
|
||||
[7m[33m token_print.c [1m[34m29 [0m12:[][0m
|
||||
;
|
||||
+----+----+
|
||||
COM OTHER
|
||||
|
|
|
|||
Loading…
Reference in a new issue