summaryrefslogtreecommitdiffstats
path: root/src/ft_m_loop.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-04-20 20:15:05 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-04-20 20:15:05 +0200
commit3dc5aab22395ad305dd933226fef3aa553cb7970 (patch)
treef2f089307f0bf1892e1a45a8bed501b98171b9fe /src/ft_m_loop.c
parentLinked list not working but ok (diff)
download42-minishell-3dc5aab22395ad305dd933226fef3aa553cb7970.tar.gz
42-minishell-3dc5aab22395ad305dd933226fef3aa553cb7970.tar.bz2
42-minishell-3dc5aab22395ad305dd933226fef3aa553cb7970.tar.xz
42-minishell-3dc5aab22395ad305dd933226fef3aa553cb7970.tar.zst
42-minishell-3dc5aab22395ad305dd933226fef3aa553cb7970.zip
Wrong address
Diffstat (limited to '')
-rw-r--r--src/ft_m_loop.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/ft_m_loop.c b/src/ft_m_loop.c
index d993ac6..557a9b0 100644
--- a/src/ft_m_loop.c
+++ b/src/ft_m_loop.c
@@ -24,15 +24,25 @@ int32_t
{
int8_t gnl;
char *line;
+ t_lcom *head;
gnl = 1;
while (gnl > 0)
{
ft_m_prompt(msh);
gnl = get_next_line(STDIN_FILENO, &line);
- ft_p_line(line, msh);
- ft_memdel((void*)&line);
- ft_e_lcom(msh->lcom_head, msh);
+ if (line[0] != '\0')
+ {
+ head = msh->lcom;
+ ft_p_line(line, msh);
+ ft_memdel((void*)&line);
+ ft_e_lcom(head, msh);
+ /* TODO: memdel lcom - INSTALL VALGRIND */
+ }
+ else
+ {
+ ft_memdel((void*)&line);
+ }
}
return (FT_RET_FINE);
}