diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-21 16:09:25 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-04-21 16:09:25 +0200 |
commit | 23c53fec41ef1c9b62757c73b8ff8362139f8838 (patch) | |
tree | e2604b61531d9e6864c3b6038d8ea6848fc02903 /src/ft_e_lcom.c | |
parent | Good (diff) | |
download | 42-minishell-23c53fec41ef1c9b62757c73b8ff8362139f8838.tar.gz 42-minishell-23c53fec41ef1c9b62757c73b8ff8362139f8838.tar.bz2 42-minishell-23c53fec41ef1c9b62757c73b8ff8362139f8838.tar.xz 42-minishell-23c53fec41ef1c9b62757c73b8ff8362139f8838.tar.zst 42-minishell-23c53fec41ef1c9b62757c73b8ff8362139f8838.zip |
Linked list works, not memdeling
Diffstat (limited to 'src/ft_e_lcom.c')
-rw-r--r-- | src/ft_e_lcom.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/ft_e_lcom.c b/src/ft_e_lcom.c index c592f3c..b928004 100644 --- a/src/ft_e_lcom.c +++ b/src/ft_e_lcom.c @@ -17,7 +17,7 @@ static uint8_t ft_get_builtin_id(const char com[], - t_msh *msh) + t_msh *msh) { uint8_t i; @@ -32,20 +32,22 @@ static uint8_t int32_t ft_e_lcom(t_msh *msh) { + t_lcom *ptr; uint8_t bu_id; - while (msh->lcom_head != NULL) + ptr = msh->curr; + while (ptr != NULL) { - if ((bu_id = ft_get_builtin_id(msh->lcom_head->com, msh)) + if ((bu_id = ft_get_builtin_id(ptr->com, msh)) < FT_BUILTINS_COUNT) { - msh->bu_ptr[bu_id](msh->lcom_head->args, msh); + msh->bu_ptr[bu_id](ptr->args, msh); } else { /* TODO: exec path stuff */ } - msh->lcom_head = msh->lcom_head->next; + ptr = ptr->next; } return (0); } |