aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2020-04-12 18:36:17 +0200
committerCharles <sircharlesaze@gmail.com>2020-05-04 12:01:03 +0200
commit9fabc25a980550afc6337fd729632462f2680daa (patch)
treef86939c99fe918fa35f4b0d12bc00e03f034ac8d /include
parent4aeba6d2f03706fa21281709a138a7d3ea9797dc (diff)
downloadminishell-9fabc25a980550afc6337fd729632462f2680daa.tar.gz
minishell-9fabc25a980550afc6337fd729632462f2680daa.tar.bz2
minishell-9fabc25a980550afc6337fd729632462f2680daa.zip
Removing data name in ast union, io_frame, root line ast tag
Diffstat (limited to 'include')
-rw-r--r--include/ast.h19
-rw-r--r--include/eval.h23
2 files changed, 23 insertions, 19 deletions
diff --git a/include/ast.h b/include/ast.h
index 6470a17..b725c8b 100644
--- a/include/ast.h
+++ b/include/ast.h
@@ -6,7 +6,7 @@
/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/04/01 17:05:38 by charles #+# #+# */
-/* Updated: 2020/04/02 13:27:59 by charles ### ########.fr */
+/* Updated: 2020/05/04 11:59:43 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -25,10 +25,10 @@
/*
** \brief Separator type
-** \param SEP_END Regular command end `;`
-** \param SEP_PIPE Pipe output of left to right `|`
-** \param SEP_AND Execute right if left status == 0 `&&`
-** \param SEP_OR Execute right if left status != 0 `||`
+** \param SEP_END `;` Regular command end
+** \param SEP_PIPE `|` Pipe output of left to right
+** \param SEP_AND `&&` Execute right if left status == 0
+** \param SEP_OR `||` Execute right if left status != 0
*/
typedef enum e_sep
@@ -76,22 +76,19 @@ typedef struct s_cmd
** \brief AST node tag (type)
** \param TAG_CMD Command AST node
** \param TAG_LINE Line AST node
-** \param TAG_ROOT Root line AST node
*/
typedef enum e_ast_tag
{
TAG_CMD,
TAG_LINE,
- TAG_ROOT,
} t_ast_tag;
/*
** \brief AST node struct
** \param tag Node tag
-** \param data Union containning possible node data
-** \param data::cmd Command struct
-** \param data::line Line struct
+** \param cmd Command struct
+** \param line Line struct
*/
typedef struct s_ast
@@ -101,7 +98,7 @@ typedef struct s_ast
{
t_line line;
t_cmd cmd;
- } data;
+ } ;
} t_ast;
t_ast *ast_new(t_ast_tag tag, void *data);
diff --git a/include/eval.h b/include/eval.h
index 31f79c2..fc149b2 100644
--- a/include/eval.h
+++ b/include/eval.h
@@ -6,7 +6,7 @@
/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/04/01 17:05:30 by charles #+# #+# */
-/* Updated: 2020/04/02 15:38:11 by charles ### ########.fr */
+/* Updated: 2020/05/04 11:58:16 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -27,8 +27,7 @@
typedef struct
{
- int pipe_in[2];
- int pipe_out[2];
+ int p[2];
t_path path;
t_env env;
} t_eval_state;
@@ -45,15 +44,24 @@ typedef struct s_eval_status
typedef struct
{
- int pipe_in[2];
- int pipe_out[2];
-} t_io_frame;
+ t_eval_state *state;
+ t_line *line;
+ int fd_in;
+ int fd_out;
+} t_fork_param_line;
+
+typedef struct
+{
+ char *exec_path;
+ char **argv;
+ char **envp;
+} t_fork_param_execve;
/*
** eval.c
*/
-int eval(t_io_frame *frame, t_eval_state *state, t_ast *ast);
+int eval(int fd_in, int fd_out, t_eval_state *state, t_ast *ast);
/*
** exec.c
@@ -69,6 +77,5 @@ char *exec_search_path(t_path path, char *path_var, char *exec_name);
int pipe_setup_parent(t_cmd *cmd, int pipe_in[2], int pipe_out[2]);
int pipe_setup_child(int pipe_in[2], int pipe_out[2]);
-int io_frame_init(t_io_frame *frame);
#endif