summaryrefslogtreecommitdiffstats
path: root/src/ft_e_lcom.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-04-23 16:51:23 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-04-23 16:51:23 +0200
commitb670d2474de9da94ea893182ff1269259d9a01fb (patch)
treeed5d78bb64788fcbe44b759d46104780440df560 /src/ft_e_lcom.c
parentNow searching in $PATH (diff)
download42-minishell-b670d2474de9da94ea893182ff1269259d9a01fb.tar.gz
42-minishell-b670d2474de9da94ea893182ff1269259d9a01fb.tar.bz2
42-minishell-b670d2474de9da94ea893182ff1269259d9a01fb.tar.xz
42-minishell-b670d2474de9da94ea893182ff1269259d9a01fb.tar.zst
42-minishell-b670d2474de9da94ea893182ff1269259d9a01fb.zip
PATH
Diffstat (limited to '')
-rw-r--r--src/ft_e_lcom.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/ft_e_lcom.c b/src/ft_e_lcom.c
index c0a137a..a23b32c 100644
--- a/src/ft_e_lcom.c
+++ b/src/ft_e_lcom.c
@@ -12,6 +12,7 @@
#include <libft.h>
#include "ft_e_builtins.h"
+#include "ft_e_externs.h"
#include "ft_s_struct.h"
static uint8_t
@@ -21,14 +22,14 @@ static uint8_t
uint8_t i;
i = 0;
- while (ft_strncmp(com, msh->bu_ref[i], 7) != 0)
+ while (msh->bu_ref[i] && ft_strncmp(com, msh->bu_ref[i], 7) != 0)
{
i++;
}
return (i);
}
-uint8_t
+void
ft_e_lcom(t_msh *msh)
{
t_lcom *ptr;
@@ -37,16 +38,14 @@ uint8_t
ptr = msh->curr;
while (ptr != NULL)
{
- if ((bu_id = ft_get_builtin_id(ptr->com, msh))
- < FT_BUILTINS_COUNT)
+ if ((bu_id = ft_get_builtin_id(ptr->com, msh)) < FT_BUILTINS_COUNT)
{
ft_e_builtin(ptr, bu_id, msh);
}
else
{
- /* TODO: exec $PATH stuff | initiate all builtins first, even uncomplete */
+ ft_e_extern(ptr, msh);
}
ptr = ptr->next;
}
- return (0);
}