Implemented some ast handlings...

ast lists, and_or, redirection and builtins
This commit is contained in:
Jean Herail 2026-01-17 17:33:22 +01:00 committed by william.valenduc
parent cf7825aaf0
commit e9b6d39760
10 changed files with 359 additions and 14 deletions

29
src/utils/ast/ast_redir.h Normal file
View file

@ -0,0 +1,29 @@
#ifndef AST_REDIR_H
#define AST_REDIR_H
#include <stdbool.h>
#include "utils/ast/ast_base.h"
enum ast_redir_type {
AST_REDIR_TYPE_LESS, // <
AST_REDIR_TYPE_GREAT, // >
AST_REDIR_TYPE_DLESS, // <<
AST_REDIR_TYPE_DGREAT, // >>
AST_REDIR_TYPE_LESSAND, // <&
AST_REDIR_TYPE_GREATAND, // >&
AST_REDIR_TYPE_CLOBBER // >|
};
struct ast_redir {
struct ast *child;
char *filename;
int io_number; // The FD being redirected (default -1 if not specified, implies 0 or 1 based on type)
enum ast_redir_type type;
};
bool ast_is_redir(struct ast *node);
struct ast_redir *ast_get_redir(struct ast *node);
struct ast *ast_create_redir(struct ast *child, char *filename, int io_number, enum ast_redir_type type);
void ast_free_redir(struct ast_redir *redir);
#endif /* ! AST_REDIR_H */