diff options
Diffstat (limited to 'src/b_alias.c')
-rw-r--r-- | src/b_alias.c | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/src/b_alias.c b/src/b_alias.c index fc1651b..c94a6db 100644 --- a/src/b_alias.c +++ b/src/b_alias.c @@ -20,6 +20,7 @@ #endif #include "b_alias_print.h" +#include "b_alias_register.h" #include "d_define.h" #include "s_struct.h" #include "u_alias.h" @@ -72,43 +73,6 @@ static unsigned char b_print_arg(const char arg[], t_msh *msh) return (b_print_arg_next(ptr, arg, invalid, msh)); } -#include <stdlib.h> -static void b_register_arg(const char arg[], t_msh *msh) -{ - char *ptr; - char *rptr; - char name[255]; - char value[ARG_MAX]; - char tmp; - - ptr = (char*)arg; - while (*ptr != C_NUL && *ptr != C_EQUALS) - { - ptr++; - } - if (*ptr == C_EQUALS) - { - ft_strlcpy(name, arg, (ptr - arg < 255) ? ((ptr - arg) + 1) : (255)); - ptr += 1; - rptr = ptr; - while (*rptr != C_NUL && ft_iswhitespace(*rptr) == TRUE) - rptr++; - tmp = *(rptr + ft_strlen(name)); - *(rptr + ft_strlen(name)) = C_NUL; - if (ft_strncmp(rptr, name, ft_strlen(name) + 1) == 0) { - *(rptr + ft_strlen(name)) = tmp; - ft_strlcpy(value, ptr, ARG_MAX); - ft_memmove(value + (rptr - ptr) + 1, value + (rptr - ptr), ft_strlen(value + (rptr - ptr)) + 1); - *(value + (rptr - ptr)) = C_BACKS; - } - else { - *(rptr + ft_strlen(name)) = tmp; - ft_strlcpy(value, ptr, ARG_MAX); - } - u_set_alias_value(name, value, msh); - } -} - unsigned char b_alias(char *args[], t_msh *msh) { const unsigned long argc = u_builtins_get_argc((const char**)args); |