summaryrefslogtreecommitdiffstats
path: root/src/p_lblock_next.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-09-11 21:18:27 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-09-11 21:18:27 +0200
commitff845bada3fe6898a228c10422f0561e2a532622 (patch)
treeb6c407875f7a87bc28e55426a7f3d2fd101be47a /src/p_lblock_next.c
parentqwe (diff)
download42-minishell-ff845bada3fe6898a228c10422f0561e2a532622.tar.gz
42-minishell-ff845bada3fe6898a228c10422f0561e2a532622.tar.bz2
42-minishell-ff845bada3fe6898a228c10422f0561e2a532622.tar.xz
42-minishell-ff845bada3fe6898a228c10422f0561e2a532622.tar.zst
42-minishell-ff845bada3fe6898a228c10422f0561e2a532622.zip
Fuck this
Diffstat (limited to 'src/p_lblock_next.c')
-rw-r--r--src/p_lblock_next.c96
1 files changed, 35 insertions, 61 deletions
diff --git a/src/p_lblock_next.c b/src/p_lblock_next.c
index 6f5f00d..10c4d84 100644
--- a/src/p_lblock_next.c
+++ b/src/p_lblock_next.c
@@ -93,20 +93,8 @@ void
void
p_subst_alias(char word[], t_msh *msh)
{
- /* char subst[ARG_MAX]; */
- char *ptr;
-
- ptr = word;
+ (void)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
@@ -219,56 +207,42 @@ static void
msh->env_fork_tmp[j][0] = '\0';
}
-void
- p_check_args_equals(char word[], t_msh *msh)
+char
+ **p_check_args_equals(char *words[], t_msh *msh)
{
- char *ptr;
- t_quote_mode mode;
+ char *ptr;
+ t_bool reg;
+ t_bool isvar;
+ int64_t i;
- mode = Q_NONE;
- ptr = word;
- while (*ptr != C_NUL)
+ i = 0;
+ reg = FALSE;
+ isvar = FALSE;
+ while (words[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)
- ptr++;
+ 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++;
}
- /* 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); */
+ if (isvar == TRUE)
+ return (p_add_to_variables_and_delete(words, reg, i, msh));
+ return (words);
}