summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/ft_e_lcom.c3
-rw-r--r--src/ft_m_loop.c1
-rw-r--r--src/ft_s_lcom.c13
3 files changed, 10 insertions, 7 deletions
diff --git a/src/ft_e_lcom.c b/src/ft_e_lcom.c
index 57998cb..3288112 100644
--- a/src/ft_e_lcom.c
+++ b/src/ft_e_lcom.c
@@ -39,8 +39,7 @@ void
ptr = msh->curr;
while (ptr != NULL)
{
- /* TODO: FIX THAT */
- if (ptr->com[0])
+ if (ptr->com)
{
if ((bu_id = ft_get_builtin_id(ptr->com, msh)) < FT_BUILTINS_COUNT)
{
diff --git a/src/ft_m_loop.c b/src/ft_m_loop.c
index 14f40a9..7f805a2 100644
--- a/src/ft_m_loop.c
+++ b/src/ft_m_loop.c
@@ -36,7 +36,6 @@ uint8_t
ft_memdel((void*)&line);
ft_e_lcom(msh);
ft_lcom_clear(&msh->curr);
- /* TODO: segv on spaces only "msh ~> " */
/* TODO: segv on ';' terminated lines "msh ~> echo qwe;" */
/* TODO: (null): Bad address on "msh ~> echo a > asd; cat < asd" but not on "msh ~> echo a > asd; cat asd" */
/* TODO: GNL 25 leak on "msh ~> exit" */
diff --git a/src/ft_s_lcom.c b/src/ft_s_lcom.c
index 33ad5da..03b2f67 100644
--- a/src/ft_s_lcom.c
+++ b/src/ft_s_lcom.c
@@ -27,10 +27,15 @@ static int8_t
uint64_t j;
i = 0;
- if (!((*lcom)->com = (char*)malloc((ft_strlen(words[0]) + 1) *
- sizeof(char))))
- return (-1);
- ft_strlcpy((*lcom)->com, words[0], ft_strlen(words[0]) + 1);
+ if (words[0])
+ {
+ if (!((*lcom)->com = (char*)malloc((ft_strlen(words[0]) + 1) *
+ sizeof(char))))
+ return (-1);
+ ft_strlcpy((*lcom)->com, words[0], ft_strlen(words[0]) + 1);
+ }
+ else
+ return (0);
while(words[i])
{
/* TODO: cut fd number "msh ~> echo a 2>file" */