-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpipex.h
55 lines (48 loc) · 1.98 KB
/
pipex.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* pipex.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: aelsayed <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/12/14 17:27:09 by aelsayed #+# #+# */
/* Updated: 2025/02/13 19:06:17 by aelsayed ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef PIPEX_H
# define PIPEX_H
# include "LIBFT/libft.h"
# include <errno.h>
# include <sys/wait.h>
typedef struct s_variables
{
int fdo;
int fdi;
pid_t pid1;
pid_t pid2;
char *path1;
char *path2;
char **args;
int pipefd[2];
} t_var;
char *ft_strjoin2(char *s1, char *s2);
// pipex fcts
char **trim(char **ar);
char *check_path(char **envp, char *cmd);
char *free_paths(char ***paths, char **cmd);
void exit_error(int specifier, int exitt, char error, char *file);
int file_opener(char *infile, char *outfile, char c, int perm);
// main helpers
void wait_process(pid_t pid1, pid_t pid2);
int globale_variable(int nb);
int path_index(char **envp);
int bpath_err(char **av, int ac);
void closer(int fdi, int fdo, int *pipefd, int bool);
void open_pipe(t_var *vars, char **av, int ac);
void bfork_parent(t_var *vars, char **av, char **envp, int ac);
void redirect(t_var *vars);
void check(t_var *var, char *s);
void fork_child(t_var *vars, char **av, char **envp);
void bfork_child(t_var *vars, char **av, char **envp, int ac);
void ft_bonus(int ac, char **av, char **envp, t_var *vars);
#endif