diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ft_e_externs.c | 23 | ||||
-rw-r--r-- | src/ft_e_externs.h | 21 | ||||
-rw-r--r-- | src/ft_e_lcom.c | 11 | ||||
-rw-r--r-- | src/ft_e_lcom.h | 2 |
4 files changed, 50 insertions, 7 deletions
diff --git a/src/ft_e_externs.c b/src/ft_e_externs.c new file mode 100644 index 0000000..cbfb1f0 --- /dev/null +++ b/src/ft_e_externs.c @@ -0,0 +1,23 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_e_externs.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:19:27 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:19:29 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#include <libft.h> +#include "ft_s_struct.h" + +void + ft_e_extern(t_lcom *ptr, + t_msh *msh) +{ + (void)ptr; + (void)msh; + /* TODO: exec $PATH stuff | initiate all builtins first, even uncomplete */ +} diff --git a/src/ft_e_externs.h b/src/ft_e_externs.h new file mode 100644 index 0000000..bee3f1e --- /dev/null +++ b/src/ft_e_externs.h @@ -0,0 +1,21 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* ft_e_externs.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/02/14 17:19:27 by rbousset #+# #+# */ +/* Updated: 2020/02/14 17:19:29 by rbousset ### ########lyon.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef FT_E_EXTERN_H +#define FT_E_EXTERN_H + +#include "ft_s_struct.h" + +void ft_e_extern(t_lcom *ptr, + t_msh *msh); + +#endif 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); } diff --git a/src/ft_e_lcom.h b/src/ft_e_lcom.h index 5724544..5244001 100644 --- a/src/ft_e_lcom.h +++ b/src/ft_e_lcom.h @@ -16,6 +16,6 @@ #include <stdint.h> #include "ft_s_struct.h" -uint8_t ft_e_lcom(t_msh *msh); +void ft_e_lcom(t_msh *msh); #endif |