diff options
Diffstat (limited to 'src/p_lblock_next.c')
-rw-r--r-- | src/p_lblock_next.c | 108 |
1 files changed, 71 insertions, 37 deletions
diff --git a/src/p_lblock_next.c b/src/p_lblock_next.c index a5314f2..adfa043 100644 --- a/src/p_lblock_next.c +++ b/src/p_lblock_next.c @@ -19,6 +19,7 @@ #include "s_destroy.h" #include "f_fail.h" #include "s_struct.h" +#include "u_alias.h" #include "u_parse.h" #include "u_utils.h" #include "u_vars.h" @@ -66,8 +67,8 @@ static void *(p) = word + (i + ft_strlen(varval) - 1); } -char - *p_subst_vars(char word[], t_msh *msh) +void + p_subst_vars(char word[], t_msh *msh) { char *ptr; t_quote_mode mode; @@ -87,7 +88,25 @@ char } ptr++; } - return (word); +} + +void + p_subst_alias(char word[], t_msh *msh) +{ + /* char subst[ARG_MAX]; */ + char *ptr; + + ptr = word; + (void)msh; + ft_printf("[%s]\n", ptr); + /* while (*ptr != C_NUL) */ + /* { */ + /* ptr++; */ + /* } */ + /* if (u_get_alias_value(subst, ?, ARG_MAX, msh) == 0) */ + /* { */ + /* /\* copy *\/ */ + /* } */ } char @@ -200,42 +219,57 @@ static void msh->env_fork_tmp[j][0] = '\0'; } -char - **p_check_args_equals(char *words[], t_msh *msh) +void + p_check_args_equals(char word[], t_msh *msh) { - char *ptr; - t_bool reg; - t_bool isvar; - int64_t i; + char *ptr; + t_quote_mode mode; - i = 0; - reg = FALSE; - isvar = FALSE; - while (words[i]) + mode = Q_NONE; + ptr = word; + while (*ptr != C_NUL) { - ptr = words[i]; - while (*ptr != '\0' && *ptr != '=') - ptr++; - if (*ptr == '=') - { - reg = TRUE; - isvar = TRUE; - } - if (*ptr == '\0' || words[i][0] == '=' || - ft_isdigit(words[i][0]) == TRUE) - { - reg = FALSE; - if (i == 0) - isvar = FALSE; - if (isvar == TRUE) - p_add_to_env_fork(i, words, msh); - else - msh->env_fork_tmp[0][0] = '\0'; - break ; - } - i++; + if (*ptr == C_DQUOTE) + mode = u_meet_dquote(word, ptr, mode); + else if (*ptr == C_SQUOTE) + mode = u_meet_squote(word, ptr, mode); + else if (mode == Q_NONE && *ptr == C_EQUALS) + u_meet_equals(); + ptr++; } - if (isvar == TRUE) - return (p_add_to_variables_and_delete(words, reg, i, msh)); - return (words); + /* char *ptr; */ + /* t_bool reg; */ + /* t_bool isvar; */ + /* int64_t i; */ + + /* i = 0; */ + /* reg = FALSE; */ + /* isvar = FALSE; */ + /* while (words[i]) */ + /* { */ + /* ptr = words[i]; */ + /* while (*ptr != '\0' && *ptr != '=') */ + /* ptr++; */ + /* if (*ptr == '=') */ + /* { */ + /* reg = TRUE; */ + /* isvar = TRUE; */ + /* } */ + /* if (*ptr == '\0' || words[i][0] == '=' || */ + /* ft_isdigit(words[i][0]) == TRUE) */ + /* { */ + /* reg = FALSE; */ + /* if (i == 0) */ + /* isvar = FALSE; */ + /* if (isvar == TRUE) */ + /* p_add_to_env_fork(i, words, msh); */ + /* else */ + /* msh->env_fork_tmp[0][0] = '\0'; */ + /* break ; */ + /* } */ + /* i++; */ + /* } */ + /* if (isvar == TRUE) */ + /* return (p_add_to_variables_and_delete(words, reg, i, msh)); */ + /* return (words); */ } |