summaryrefslogtreecommitdiffstats
path: root/src/c_utils.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_utils.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_utils.c')
-rw-r--r--src/c_utils.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/c_utils.c b/src/c_utils.c
index 43d6452..b39e580 100644
--- a/src/c_utils.c
+++ b/src/c_utils.c
@@ -24,10 +24,9 @@
/*
** TODO:
-** quotes
** leaks on line
+** quotes
** C-c
-** tests varies
** NORME
** MULTILIGHNE
** term(0) on exit DONE
@@ -83,19 +82,18 @@ uint16_t
}
int16_t
- c_new_line(char *buf,
- char **line,
+ c_new_line(char *line,
t_msh *msh,
t_caps *tcaps)
{
- write(1, buf, ft_strlen(buf));
+ write(1, "\n", 1);
tputs(tgetstr("cr", NULL), 1, ft_putchar);
c_set_term_raw(0);
if (line != NULL)
{
- m_parse_and_run_line(*line, msh);
- *line = NULL;
- free(*line);
+ m_parse_and_run_line(line, msh);
+ line = NULL;
+ free(line);
}
tcaps->cpos = 0;
tputs(tgetstr("cr", NULL), 1, ft_putchar);
@@ -133,8 +131,7 @@ char
j++;
}
}
- free(str);
- dst[i] = '\0';
+ ft_memdel((void**)&str);
return (dst);
}