/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* s_struct.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rbousset +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* 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 # include # ifdef __linux__ # include # else # include # endif # 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 ** ------------------- ** -3: <<- ** -2: << ** -1: < ** 1: > ** 2: >> ** 3: >& ** 0: means no redirection */ typedef struct s_lredir { char path[PATH_MAX]; char *heredoc; int32_t fd; int32_t right_fd; int8_t redir; struct s_lredir *next; } t_lredir; typedef struct s_com { char **argv; char **env_fork; char *bin; struct s_lredir *rdr; } 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; int32_t argc; char **argv; char **envp; char *prev_hist; char *curr_hist_ptr; char ps[4][255]; char env_fork_tmp[128][4096]; char sqb_ref[B_ID_SQB_COUNT][4]; char *cwd; int32_t fd; uint8_t (*bu_ptr[B_BUILTINS_COUNT])(char **, struct s_msh*); uint8_t ret; } t_msh; #endif