fix: small errors in exec and parser

This commit is contained in:
matteo 2026-01-29 09:59:16 +01:00
parent d775ab6c1a
commit 46dde29c20
3 changed files with 5 additions and 4 deletions

View file

@ -123,7 +123,7 @@ static int get_fd_target(const struct ast_redir *redir)
if (redir->io_number != -1)
return redir->io_number;
if (redir->type == AST_REDIR_TYPE_LESS
|| redir->type == AST_REDIR_TYPE_DLESS
|| redir->type == AST_REDIR_TYPE_LESSGREAT
|| redir->type == AST_REDIR_TYPE_LESSAND)
return 0;
return 1;

View file

@ -106,15 +106,15 @@ bool grammar_init(void)
add_first(RULE_LIST, TOKEN_WORD);
add_first(RULE_LIST, TOKEN_IF);
add_first(RULE_COMMAND, TOKEN_NEGATION);
add_first(RULE_LIST, TOKEN_NEGATION);
add_first(RULE_AND_OR, TOKEN_WORD);
add_first(RULE_AND_OR, TOKEN_IF);
add_first(RULE_COMMAND, TOKEN_NEGATION);
add_first(RULE_AND_OR, TOKEN_NEGATION);
add_first(RULE_PIPELINE, TOKEN_WORD);
add_first(RULE_PIPELINE, TOKEN_IF);
add_first(RULE_COMMAND, TOKEN_NEGATION);
add_first(RULE_PIPELINE, TOKEN_NEGATION);
add_first(RULE_COMMAND, TOKEN_WORD);
add_first(RULE_COMMAND, TOKEN_IF);

View file

@ -261,6 +261,7 @@ struct ast *parse_simple_command(struct lexer_context *ctx)
}
// Result
// TODO handle assignements
struct ast *result = ast_create_command(command_elements, redirections);
if (result == NULL)
{