2026-01-17 17:33:22 +01:00
|
|
|
#ifndef AST_REDIR_H
|
|
|
|
|
#define AST_REDIR_H
|
|
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
2026-01-17 19:11:55 +01:00
|
|
|
|
2026-01-17 17:33:22 +01:00
|
|
|
#include "utils/ast/ast_base.h"
|
|
|
|
|
|
2026-01-17 19:11:55 +01:00
|
|
|
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 // >|
|
2026-01-17 17:33:22 +01:00
|
|
|
};
|
|
|
|
|
|
2026-01-17 19:11:55 +01:00
|
|
|
struct ast_redir
|
|
|
|
|
{
|
2026-01-17 17:33:22 +01:00
|
|
|
struct ast *child;
|
|
|
|
|
char *filename;
|
2026-01-17 19:11:55 +01:00
|
|
|
int io_number; // The FD being redirected (default -1 if not specified,
|
|
|
|
|
// implies 0 or 1 based on type)
|
2026-01-17 17:33:22 +01:00
|
|
|
enum ast_redir_type type;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
bool ast_is_redir(struct ast *node);
|
|
|
|
|
struct ast_redir *ast_get_redir(struct ast *node);
|
2026-01-17 19:11:55 +01:00
|
|
|
struct ast *ast_create_redir(struct ast *child, char *filename, int io_number,
|
|
|
|
|
enum ast_redir_type type);
|
2026-01-17 17:33:22 +01:00
|
|
|
void ast_free_redir(struct ast_redir *redir);
|
|
|
|
|
|
|
|
|
|
#endif /* ! AST_REDIR_H */
|