summaryrefslogtreecommitdiffstats
path: root/src
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
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_e_lcom.c2
-rw-r--r--src/ft_m_loop.c16
-rw-r--r--src/ft_p_lcom.c2
-rw-r--r--src/ft_p_line.c1
-rw-r--r--src/ft_s_init.c1
-rw-r--r--src/ft_s_struct.h1
6 files changed, 16 insertions, 7 deletions
diff --git a/src/ft_e_lcom.c b/src/ft_e_lcom.c
index 5e37084..5624457 100644
--- a/src/ft_e_lcom.c
+++ b/src/ft_e_lcom.c
@@ -37,7 +37,7 @@ int32_t
while (lcom != NULL)
{
- ft_printf("qwe\n");
+ ft_printf("qwe\n");
if ((bu_id = ft_get_builtin_id(lcom->com, msh)) < FT_BUILTINS_COUNT)
{
msh->bu_ptr[bu_id](msh);
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);
}
diff --git a/src/ft_p_lcom.c b/src/ft_p_lcom.c
index 3ea6b16..f965555 100644
--- a/src/ft_p_lcom.c
+++ b/src/ft_p_lcom.c
@@ -20,8 +20,8 @@ int8_t
const int64_t count,
t_msh *msh)
{
- char **words;
int64_t i;
+ char **words;
i = 0;
if (!(words = ft_split(line, ';')))
diff --git a/src/ft_p_line.c b/src/ft_p_line.c
index 8670231..ddaf0bd 100644
--- a/src/ft_p_line.c
+++ b/src/ft_p_line.c
@@ -30,4 +30,5 @@ void
exit(FT_RET_ALLOC);
}
}
+ /* TODO: fun */
}
diff --git a/src/ft_s_init.c b/src/ft_s_init.c
index c6f22ba..27075cf 100644
--- a/src/ft_s_init.c
+++ b/src/ft_s_init.c
@@ -34,6 +34,5 @@ t_msh
msh->ret = 0;
ft_init_buptr(msh);
msh->lcom = NULL;
- msh->lcom_head = msh->lcom;
return (msh);
}
diff --git a/src/ft_s_struct.h b/src/ft_s_struct.h
index 750c95b..603b885 100644
--- a/src/ft_s_struct.h
+++ b/src/ft_s_struct.h
@@ -30,7 +30,6 @@ typedef struct s_msh
int32_t ret;
char **bu_ref;
int32_t (*bu_ptr[FT_BUILTINS_COUNT])(struct s_msh*);
- struct s_lcom *lcom_head;
struct s_lcom *lcom;
} t_msh;