-
Notifications
You must be signed in to change notification settings - Fork 0
/
pipex.h
65 lines (54 loc) · 1.95 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
56
57
58
59
60
61
62
63
64
65
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* pipex.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: yrhiba <yrhiba@student.1337.ma> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/20 02:40:28 by yrhiba #+# #+# */
/* Updated: 2022/12/06 03:43:56 by yrhiba ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef PIPEX_H
# define PIPEX_H
# define HERDOC "here_doc"
# define PATH "PATH="
# define TMPFD ".tempfd"
# include "libft.h"
# include <errno.h>
# include <fcntl.h>
# include <stdio.h>
# include <stdlib.h>
# include <string.h>
# include <sys/types.h>
# include <sys/wait.h>
# include <unistd.h>
typedef struct s_pipex
{
size_t cmds_count;
int **pipes;
int *fds;
int *pids;
int id;
int herdoc;
int flags;
const char **av;
const char **ev;
char **args;
char *outfile;
} t_pipex;
size_t getcmdscount(t_pipex *vars, int ac, const char **av);
const char **getcmds(t_pipex *vars, const char **av);
int **getpipes(size_t count);
void closepipes(int **pipes);
int **freepipes(int **pipes);
int *getfds(int ac, const char **av, t_pipex *vars);
void rtnfds(t_pipex *vars);
void rtnforking(t_pipex *vars);
void rtnpipex(t_pipex *vars);
void closeallfds(t_pipex *vars, int *fds);
int startforking(t_pipex *vars, const char **av, const char **ev,
int *fds);
char **getcmdargs(t_pipex *vars, const char **av, const char **ev,
int index);
#endif