-
Notifications
You must be signed in to change notification settings - Fork 0
/
pipex.h
52 lines (47 loc) · 1.75 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* pipex.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: zyunusov <zyunusov@student.42wolfsburg.de> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/12 18:29:31 by zyunusov #+# #+# */
/* Updated: 2022/10/26 22:49:03 by zyunusov ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef PIPEX_H
# define PIPEX_H
# include <stdlib.h>
# include <unistd.h>
# include <string.h>
# include <stdio.h>
# include <sys/wait.h>
# include <fcntl.h>
# include <errno.h>
# include "libft/libft.h"
# define CMD_NOT_FOUND 127
# define ERR_FILE 1
typedef struct s_data
{
pid_t pid[2];
int infile;
int outfile;
int pipes[2];
int exit_status;
char *path;
char *cmd;
char **path_cmd;
char **args_cmd;
} t_data;
char *get_cmd(char **paths, char *cmd);
void free_cmd(t_data *p);
void close_pipes(t_data *p);
void ft_error_f(char *f, char *s, int err_exit);
void free_paths(t_data *data);
void child_in(t_data data, char **argv, char **envp);
void child_out(t_data data, char **argv, char **envp);
void parse_args(t_data *data, char *args);
void check_for_path(t_data *data, int i);
int ft_outfile_check(char **argv, t_data *data);
void ft_infile_check(char **argv, t_data *data);
#endif