-
Notifications
You must be signed in to change notification settings - Fork 0
/
pipex.h
59 lines (46 loc) · 1 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
#ifndef PIPEX_H
# define PIPEX_H
// -------------------------------------
# include "libft/libft.h"
# include <unistd.h>
# include <fcntl.h>
// -------------------------------------
// TYPES
typedef enum e_bool
{
TRUE = 1,
FALSE = 0
} t_bool;
/* Info needed to call new processes */
typedef struct s_command
{
char *file;
char **argv;
} t_command;
/* A defined pipe with two file descriptors */
typedef int t_pipefd[2];
/* File descriptors */
enum e_descriptors
{
READ_END = 0,
WRITE_END = 1,
STDIN = 0,
STDOUT = 1
};
/* Struct with all info */
typedef struct s_pipex
{
int in_fd;
int out_fd;
t_list *cmd_list;
} t_pipex;
// --------------------------------------
// --- FUNCTIONS ---
t_bool valid_files(int argc, char **argv);
t_list *init_cmdlist(int cmd_count, char **argv, char **envp);
t_command *get_cmd(t_list *lst);
void exec_cmd(t_pipex *data, t_list *current);
int error(char *message);
void *null_error(char *message);
void *initlst_error(t_list *lst, char ***table);
#endif