diff options
Diffstat (limited to 'src/b_type.c')
-rw-r--r-- | src/b_type.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/b_type.c b/src/b_type.c index d8c6cef..c490aae 100644 --- a/src/b_type.c +++ b/src/b_type.c @@ -72,16 +72,19 @@ static uint8_t b_check_nonbuilt(char *ptr, uint8_t ret, t_msh *msh) return (ret); } -static uint8_t b_check_builtins(char *ptr, t_msh *msh) +static uint8_t b_check_builtins(char *ptr) { - char **p_bu; + char tmp[M_BUILTINS_REF_LEN]; + char *tok_bu; - p_bu = msh->bu_ref; - while (*p_bu != NULL && ft_strncmp(ptr, *p_bu, ft_strlen(*p_bu) + 1) != 0) + ft_strlcpy(tmp, M_BUILTINS_REF, M_BUILTINS_REF_LEN); + tok_bu = ft_strtok(tmp, ":"); + while (tok_bu != NULL + && ft_strncmp(ptr, tok_bu, ft_strlen(tok_bu) + 1) != 0) { - p_bu++; + tok_bu = ft_strtok(NULL, ":"); } - if (*p_bu != NULL) + if (tok_bu != NULL) { ft_printf("%s is a shell builtin\n", ptr); return (0); @@ -110,7 +113,7 @@ uint8_t b_type(char *args[], t_msh *msh) { ft_printf("%s is aliased to `%s'\n", *ptr, p_alias->val); } - else if (b_check_builtins(*ptr, msh) == 1) + else if (b_check_builtins(*ptr) == 1) ret = b_check_nonbuilt(*ptr, ret, msh); ptr++; } |