blob: 871b0f4a752de506081017a198f112894e886c1f (
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
85
86
87
88
89
90
91
92
93
94
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* s_struct.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/14 17:19:27 by rbousset #+# #+# */
/* Updated: 2020/02/14 17:19:29 by rbousset ### ########lyon.fr */
/* */
/* ************************************************************************** */
#ifndef S_STRUCT_H
#define S_STRUCT_H
#include <stdint.h>
#include <limits.h>
#include "d_define.h"
typedef struct s_lvars
{
char *name;
char *val;
struct s_lvars *next;
} t_lvars;
typedef struct s_lalias
{
char *name;
char *val;
size_t id;
struct s_lalias *next;
} t_lalias;
/*
** redir(int8_t) index
** -------------------
** -1: <
** 1: >
** 2: >>
** 0: means no redirection
*/
typedef struct s_com
{
char **argv;
char **env_fork;
char *rdrpath;
char *bin;
int32_t rdrfd;
int8_t redir;
} t_com;
struct s_lpipes
{
struct s_com *com;
struct s_lpipes *next;
};
/*
** nextif(uint8_t) index
** ---------------------
** 0: ;
** 1: &&
** 2: ||
*/
typedef struct s_line_block
{
char *lblock;
uint8_t nextif;
struct s_line_block *next;
} t_line_block;
typedef struct s_msh
{
struct s_line_block *curr;
struct s_com *com;
struct s_lpipes *pipes;
struct s_lvars *vars;
struct s_lalias *alias;
char **envp;
char ps[4][1024];
char env_fork_tmp[128][4096];
char sqb_ref[FT_ID_SQB_COUNT][4];
char *shname;
char *cwd;
int32_t fd;
uint8_t (*bu_ptr[FT_BUILTINS_COUNT])(char **, struct s_msh*);
uint8_t ret;
} t_msh;
#endif
|