fix: redirections types

This commit is contained in:
matteo 2026-01-28 11:34:29 +01:00
parent 399d1ed3e1
commit 9a0f9bc6f1
3 changed files with 12 additions and 3 deletions

View file

@ -121,7 +121,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

@ -16,7 +16,16 @@ static enum ast_redir_type redir_tok_to_ast_type(enum token_type tok_type)
return AST_REDIR_TYPE_LESS;
case TOKEN_REDIR_RIGHT:
return AST_REDIR_TYPE_GREAT;
// TODO finish this
case TOKEN_REDIR_DOUBLE_RIGHT:
return AST_REDIR_TYPE_DGREAT;
case TOKEN_REDIR_LEFT_RIGHT:
return AST_REDIR_TYPE_LESSGREAT;
case TOKEN_REDIR_LEFT_AMP:
return AST_REDIR_TYPE_LESSAND;
case TOKEN_REDIR_RIGHT_AMP:
return AST_REDIR_TYPE_GREATAND;
case TOKEN_REDIR_RIGHT_PIPE:
return AST_REDIR_TYPE_CLOBBER;
default:
return AST_REDIR_TYPE_NULL;
}

View file

@ -8,7 +8,7 @@ enum ast_redir_type
AST_REDIR_TYPE_NULL,
AST_REDIR_TYPE_LESS, // <
AST_REDIR_TYPE_GREAT, // >
AST_REDIR_TYPE_DLESS, // <<
AST_REDIR_TYPE_LESSGREAT, // <>
AST_REDIR_TYPE_DGREAT, // >>
AST_REDIR_TYPE_LESSAND, // <&
AST_REDIR_TYPE_GREATAND, // >&