fix: make it compile

This commit is contained in:
Khaïs COLIN 2025-04-11 16:49:26 +02:00
parent 4baad88a44
commit 1866da6ea6
Signed by: logistic-bot
SSH key fingerprint: SHA256:RlpiqKeXpcPFZZ4y9Ou4xi2M8OhRJovIwDlbCaMsuAo
4 changed files with 15 additions and 22 deletions

View file

@ -3,10 +3,10 @@
/* ::: :::::::: */
/* cmd_parsing.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jguelen <jguelen@student.42.fr> +#+ +:+ +#+ */
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/03/31 10:28:28 by jguelen #+# #+# */
/* Updated: 2025/04/10 18:56:45 by jguelen ### ########.fr */
/* Updated: 2025/04/11 16:56:59 by khais ### ########.fr */
/* */
/* ************************************************************************** */
@ -62,7 +62,7 @@ t_redirect *minishell_redir_parse(t_minishell *app, t_cmd_builder *builder)
t_redirect *redir;
redir = NULL;
while (is_redir(builder->tokens->word->token_type))
while (is_redir(builder->tokens->word))
{
}
return (redir);
@ -94,13 +94,13 @@ t_cmd *minishell_simple_parse(t_minishell *app, t_cmd_builder *builder)
redir = minishell_redir_parse(app, builder);
t_redirect_add_back(&simple->value.simple->redirections, redir);
if (ft_errno_get() != FT_ESUCCESS)
return (simple_cmd_destroy(simple), NULL);
return (t_cmd_destroy(simple), NULL);
while (builder->tokens && builder->tokens->word->token_type == WORD_TOKEN)
{
simple->value.simple->words = wordlist_push(simple->value.simple->words,
wordlist_pop(&builder->tokens));
if (!simple->value.simple->words)
return (ft_errno(FT_EERRNO), simple_cmd_destroy(simple), NULL);
return (ft_errno(FT_EERRNO), t_cmd_destroy(simple), NULL);
redir = minishell_redir_parse(app, builder);
t_redirect_add_back(&simple->value.simple->redirections, redir);
}
@ -117,7 +117,7 @@ t_cmd *minishell_opt_pipeline_parse(t_minishell *app, t_cmd_builder *builder)
token = builder->tokens->word;
if (token->token_type == PIPE_TOKEN)
{
token = wordlist_pop(builder->tokens);
token = wordlist_pop(&builder->tokens);
worddesc_destroy(token);
opt = minishell_group_or_smp_parse(app, builder);
if (!opt)
@ -138,7 +138,7 @@ ft_printf("%s() %s\n", __FUNCTION__, builder->tokens->word->word);
if (builder->tokens->word->token_type == OPEN_PARENTH_TOKEN)
{
worddesc_destroy(wordlist_pop(builder->tokens));
worddesc_destroy(wordlist_pop(&builder->tokens));
subtree = minishell_cmds_parse(app, builder);
if (!subtree
|| builder->tokens->word->token_type != CLOSE_PARENTH_TOKEN)
@ -148,7 +148,7 @@ ft_printf("%s() %s\n", __FUNCTION__, builder->tokens->word->word);
parse_error(app, builder->tokens->word);
return (t_cmd_destroy(subtree), NULL);
}
worddesc_destroy(wordlist_pop(builder->tokens));
worddesc_destroy(wordlist_pop(&builder->tokens));
group = ft_calloc(1, sizeof(t_cmd));
if (!group)
return (ft_errno(FT_ENOMEM), t_cmd_destroy(subtree), NULL);
@ -179,7 +179,7 @@ ft_printf("%s() %s\n", __FUNCTION__, builder->tokens->word->word);
*connec = FT_OR;
else
*connec = FT_AND;
token = wordlist_pop(builder->tokens);
token = wordlist_pop(&builder->tokens);
worddesc_destroy(token);
opt = minishell_pipeline_parse(app, builder);
if (!opt)
@ -276,7 +276,7 @@ ft_printf("%s() %s\n", __FUNCTION__, builder->tokens->word->word);
opt = minishell_opt_cmds_parse(app, builder, &connec);
}
if (ft_errno_get() != FT_ESUCCESS)
return (destroy(subtree), NULL);
return (t_cmd_destroy(subtree), NULL);
return (list);
}