This commit is contained in:
Loic Deridder
2025-02-12 10:10:29 +01:00
parent ced584b17a
commit adc59eb33b
20 changed files with 822 additions and 662 deletions

View File

@@ -11,7 +11,7 @@
/* ************************************************************************** */
#ifndef EXEC_H
#define EXEC_H
# define EXEC_H
# include "../minishell.h"
# include <stdio.h>
@@ -19,7 +19,50 @@
# include <sys/types.h>
# include <stdlib.h>
# include <unistd.h>
# include <time.h>
int execute_command(t_ast_n *node);
int execute_command(t_ast_n *node);
//EXEC_REDIR
void handle_file(t_ast_n *node, int check, int i);
void handle_redir(t_ast_n *node);
void reset_redir(t_ast_n *node);
int err_fork_pline(int *pipes);
//EXEC_BUILTIN
int is_builtin(char *str);
int exec_builtin(t_ast_n *node);
//EXEC_PLINE
void exec_pcmd(t_ast_n *pcmd);
void exec_pchild(int *pipes, int index, t_ast_n *pcmd, int cmds);
int end_pline(pid_t last_pid, t_ast_n **pline);
int exec_pline(t_ast_n **pline);
//EXEC_SUBSH
int exec_shcmd(t_ast_n *node);
int execute_shcommand(t_ast_n *node);
int exec_subsh(t_ast_n *node);
//EXEC_HEREDOC
void expander_here(char **str, t_ast_n *node);
void here_remove_quote(t_ast_n *node, int j, char c);
int ifhere_remove_quote(t_ast_n *node, int j);
void read_input(t_ast_n *node, int j);
void here_doc(t_ast_n *node, int i);
//EXEC_UTILS
int execis_validchar(char c);
int execget_var_len(char *str, t_ast_n *node, int *j);
int get_dup_len(char *str, t_ast_n *node);
int execvalid_next(char c);
char *execextract_env(char *str, char **envp);
//EXEC_CMD
int count_cmds(t_ast_n **pline);
char *find_path(char *cmd, char **env);
void return_error(char *arg, char *msg, int code, t_ast_n *node);
int exec(t_ast_n *node);
int exec_scmd(t_ast_n *node);
#endif