summaryrefslogtreecommitdiffstats
path: root/src/c_init.c
diff options
context:
space:
mode:
authorsalad <fmoenne-@student.le-101.fr>2020-09-16 13:15:00 +0200
committersalad <fmoenne-@student.le-101.fr>2020-09-16 13:15:00 +0200
commitee5675b9bb8a0e6955d733aadf199d188058082b (patch)
treee82fe46c4a5753ce8092725d79e201c5538c276d /src/c_init.c
parentquelques additions (diff)
download42-minishell-ee5675b9bb8a0e6955d733aadf199d188058082b.tar.gz
42-minishell-ee5675b9bb8a0e6955d733aadf199d188058082b.tar.bz2
42-minishell-ee5675b9bb8a0e6955d733aadf199d188058082b.tar.xz
42-minishell-ee5675b9bb8a0e6955d733aadf199d188058082b.tar.zst
42-minishell-ee5675b9bb8a0e6955d733aadf199d188058082b.zip
reste 3 leaks + multiline
Diffstat (limited to 'src/c_init.c')
-rw-r--r--src/c_init.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/c_init.c b/src/c_init.c
index 2bc0be3..dfb97e3 100644
--- a/src/c_init.c
+++ b/src/c_init.c
@@ -72,6 +72,7 @@ int16_t
i = -1;
if (line == NULL)
{
+ ft_printf("qweqwe");
if (!(line = ft_calloc(1, sizeof(char))))
return (-1);
}
@@ -94,14 +95,6 @@ int16_t
{
return (c_key_right(ft_strlen(line), tcaps));
}
- else if (strncmp(buf, tcaps->CL, 4) == 0)
- {
- return (c_ctrl_l(line, tcaps, msh));
- }
- else if (strncmp(buf, tcaps->CC, 4) == 0)
- {
- return (c_new_line(buf, NULL, msh, tcaps));
- }
else if (strncmp(buf, tcaps->HM, 4) == 0)
{
return (c_home_key(tcaps));
@@ -110,13 +103,23 @@ int16_t
{
return (c_end_key(ft_strlen(line), tcaps));
}
+ else if (strncmp(buf, tcaps->CC, 4) == 0)
+ {
+ return (c_new_line(NULL, msh, tcaps));
+ }
+ else if (strncmp(buf, tcaps->CL, 4) == 0)
+ {
+ return (c_ctrl_l(line, tcaps, msh));
+ }
else if (strncmp(buf, tgetstr("kb", NULL), ft_strlen(tgetstr("kb", NULL))) == 0)
{
return (c_back_slash(&line, tcaps));
}
else if (buf[0] == '\n')
{
- return (c_new_line(buf, &line, msh, tcaps));
+ c_new_line(ft_strdup(line), msh, tcaps);
+ ft_memdel((void**)&line);
+ return (1);
}
else
return (0);