blob: f273a6f38ab1d1305e0da59a164d2f9a50008a0e (
plain)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* minishell.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/26 15:33:51 by cacharle #+# #+# */
/* Updated: 2020/02/26 16:10:56 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef MINISHELL_H
# define MINISHELL_H
# include "libft.h"
# include "libft_ht.h"
typedef struct
{
int argc;
char **argv;
} t_command;
typedef int t_status;
typedef enum
{
REDIRECTION_OUT,
REDIRECTION_IN,
REDIRECTION_APPEND
} t_redirection_type;
typedef struct
{
char *filename;
t_redirection_type type;
} t_redirection;
typedef struct
{
char *name;
char **argv;
t_ftlst *redirections;
} t_command;
// parsing steps
// 1. interpolation des variable
typedef enum
{
SEPARATOR_SEMICOLON,
SEPARATOR_PIPE,
SEPARATOR_AND,
SEPARATOR_OR,
} t_separator;
typedef struct
{
t_ftlst *commands;
t_ftlst *separators;
} t_parsing;
/*
** parse/.c
*/
t_parsing *ms_parse(char *input);
/*
** builtin*.c
*/
typedef t_status (*t_builtin_func)(int argc, char **argv, char **envp);
t_builtin_func ms_echo;
t_builtin_func ms_cd;
t_builtin_func ms_pwd;
t_builtin_func ms_export;
t_builtin_func ms_unset;
t_builtin_func ms_env;
t_builtin_func ms_exit;
#endif
|