diff --git a/42sh/includes/exec.h b/42sh/includes/exec.h index e64a2aac..55d3ffb5 100644 --- a/42sh/includes/exec.h +++ b/42sh/includes/exec.h @@ -23,9 +23,6 @@ typedef long long t_type; struct s_exec { - int fdin; - int fdout; - int amp; char *aol_status; int aol_search; }; diff --git a/42sh/includes/job_control.h b/42sh/includes/job_control.h index 12b13b54..cfd60034 100644 --- a/42sh/includes/job_control.h +++ b/42sh/includes/job_control.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/10 16:55:09 by jhalford #+# #+# */ -/* Updated: 2016/12/13 12:57:25 by jhalford ### ########.fr */ +/* Updated: 2016/12/13 13:00:19 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -19,17 +19,29 @@ # define TYPE_BUILTIN -typedef struct s_job t_job; -typedef struct s_jobc t_jobc; +typedef struct s_job t_job; +typedef struct s_process t_process; +typedef struct s_jobc t_jobc; struct s_job { int id; + pid_t pgid; + char notified; + char *command; + int foreground; + t_list *first_process; +}; + +struct s_process +{ + char **argv; pid_t pid; int fdin; int fdout; - char *command; - t_type type; + char completed; + char stopped; + int status; }; struct s_jobc diff --git a/42sh/src/exec/exec_ampersand.c b/42sh/src/exec/exec_ampersand.c index 4e3e48f7..41a5a3c6 100644 --- a/42sh/src/exec/exec_ampersand.c +++ b/42sh/src/exec/exec_ampersand.c @@ -14,9 +14,9 @@ int exec_ampersand(t_btree **ast) { - data_singleton()->exec.amp = 1; + data_singleton()->exec.foreground = 1; ft_exec(&(*ast)->left); - data_singleton()->exec.amp = 0; + data_singleton()->exec.foreground = 0; ft_exec(&(*ast)->right); btree_delone(ast, &ast_free); return (0); diff --git a/42sh/src/exec/exec_less.c b/42sh/src/exec/exec_less.c index fca7b1e0..7fe46662 100644 --- a/42sh/src/exec/exec_less.c +++ b/42sh/src/exec/exec_less.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/14 17:27:08 by jhalford #+# #+# */ -/* Updated: 2016/12/13 12:24:08 by jhalford ### ########.fr */ +/* Updated: 2016/12/13 13:00:20 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/exec/ft_cmd.c b/42sh/src/exec/ft_cmd.c index 08e1aa91..3869fb32 100644 --- a/42sh/src/exec/ft_cmd.c +++ b/42sh/src/exec/ft_cmd.c @@ -55,7 +55,7 @@ int ft_cmd_exec(char *execpath, char **argv) { ft_strdel(&execpath); g_pid = pid; - if (data_singleton()->exec.amp) + if (data_singleton()->exec.foreground) job_new(argv, pid); else if (data_singleton()->exec.fdout == STDOUT) { diff --git a/42sh/src/parser/ft_parse.c b/42sh/src/parser/ft_parse.c index 99565769..cd669aa6 100644 --- a/42sh/src/parser/ft_parse.c +++ b/42sh/src/parser/ft_parse.c @@ -14,8 +14,9 @@ t_parser g_parser[] = { - {TK_SEMI | TK_AMP, &parse_separator}, + {TK_SEMI, &parse_separator}, {TK_AND_IF | TK_OR_IF, &parse_separator}, + {TK_AMP, &parse_separator}, {TK_PIPE, &parse_separator}, {TK_LESS, &parse_less}, {TK_GREAT, &parse_great},