-
Notifications
You must be signed in to change notification settings - Fork 1
/
exec.h
78 lines (62 loc) · 2.31 KB
/
exec.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* exec.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yabdelgh <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/07/13 17:14:01 by yabdelgh #+# #+# */
/* Updated: 2021/10/03 17:53:43 by yabdelgh ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef EXEC_H
# define EXEC_H
# include <unistd.h>
# include <errno.h>
# include <fcntl.h>
# include <stdlib.h>
# include <stdio.h>
# include "parsing.h"
# include "libft/libft.h"
# include <sys/types.h>
# include <sys/wait.h>
# include <sys/stat.h>
// exec_ex.c
int my_exec(t_list *cmds, t_list *envp);
// redirection_ex.c
void ft_dup2(int fd1, int fd2);
int my_redirect(t_list *redir);
int input_redirect(char *file);
int output_redirect(char *file);
int append_redirect(char *file);
// heredoc_ex.c
int ft_heredoc(t_list *cmds);
//path_ex.c
char **get_paths(t_list *envp);
char *get_cmd_path(char *cmd, char **paths);
// envp_ex.c
char **list_to_arr(t_list *lst);
int ft_display_envp(t_list *envp);
// chdir_ex.c
int ft_chdir(t_cmd *cmd, t_list *envp, char **path);
// builins_ex.c
int ft_echo(char **argv);
int ft_env(t_list *envp);
int ft_pwd(char *gpwd);
void ft_exit(char **args);
// builtin_ex.c
int is_builtin(t_cmd *cmd);
int ft_builtin(t_cmd *cmd, t_list *envp, int status);
int exec_builtin(t_cmd *cmd, t_list *envp, int status);
// cmd_ex.c
void wait_cmds(int nbr_cmds);
void close_pfds(int *pfds, int nbr);
int *create_pipes(int nbr_pipes);
int create_childs(t_list *cmds, int *pfds, t_list *envp);
// exec_ex.c
void exec_cmd(t_list *cmds, int *pfds, t_list *envp, int i);
// unset_ex.c
int ft_unset(t_list *envp, char *value);
int ft_export(t_list *envp, char *key, char *arg);
int ft_valid_env_name(char *value);
#endif