-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcommand.h
64 lines (57 loc) · 1.97 KB
/
command.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* command.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gbudau <gbudau@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/12/11 21:30:34 by gbudau #+# #+# */
/* Updated: 2021/01/27 21:59:10 by gbudau ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef COMMAND_H
# define COMMAND_H
# include "minishell.h"
enum e_redirection_type
{
REDIRECTION_NONE,
REDIRECTION_INPUT,
REDIRECTION_OUTPUT,
REDIRECTION_APPEND
};
enum e_redirection_order
{
REDIRECT_INPUT_FIRST,
REDIRECT_OUTPUT_FIRST
};
/*
** Command
** argc = number of arguments
** argv = arguments array for execve
** env = environment variables array for execve
** wstatus = return of waitpid for the current command
** ispipe = pipe simbol follow this command
** input = input redirection file
** output = output redirection file
** redirect_type = type of output redirection (normal or append)
** redirection_order = which redirection is first(from left to right)
** pid = pid running this command
** redirection_error = if there is no redirection error this flag is FALSE
*/
typedef struct s_command
{
int argc;
char **argv;
char **env;
char *input;
char *output;
int ispipe;
int wstatus;
int redirect_type;
int redirection_order;
pid_t pid;
int redirection_error;
} t_command;
int get_last_status(int status);
void print_interrupt_signal(int last_status, int ispipe);
#endif