From d7ad419073237eba2d835709f525aa7c344623ba Mon Sep 17 00:00:00 2001 From: Jack Halford Date: Sun, 26 Mar 2017 22:14:55 +0200 Subject: [PATCH] (ls) OK --- 42sh/Makefile | 4 ++-- 42sh/libft/src/lst/pop.c | 4 ++-- 42sh/src/exec/exec_destroy.c | 3 +-- 42sh/src/exec/exec_init.c | 8 ++++---- 42sh/src/exec/process_launch.c | 3 ++- 42sh/src/exec/process_set.c | 6 +++--- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/42sh/Makefile b/42sh/Makefile index 1efb305d..d75d9774 100644 --- a/42sh/Makefile +++ b/42sh/Makefile @@ -6,14 +6,14 @@ # By: wescande +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2016/08/29 21:32:58 by wescande #+# #+# # -# Updated: 2017/03/25 20:26:47 by jhalford ### ########.fr # +# Updated: 2017/03/26 22:13:53 by jhalford ### ########.fr # # # # **************************************************************************** # NAME = 42sh CC = gcc -FLAGS = -Wall -Wextra -Werror -fsanitize=address#-fvisibility=hidden +FLAGS = -Wall -Wextra -Werror D_FLAGS = -g DELTA = $$(echo "$$(tput cols)-47"|bc) diff --git a/42sh/libft/src/lst/pop.c b/42sh/libft/src/lst/pop.c index 9e7d713d..05beda83 100644 --- a/42sh/libft/src/lst/pop.c +++ b/42sh/libft/src/lst/pop.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/04 11:09:56 by jhalford #+# #+# */ -/* Updated: 2017/03/26 21:25:05 by jhalford ### ########.fr */ +/* Updated: 2017/03/26 22:14:17 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -17,7 +17,7 @@ int pop(t_list **lst) t_list *top; int item; - if (!(lst || *lst)) + if (!(lst && *lst)) return (0); top = *lst; item = top ? *(int*)top->content : 0; diff --git a/42sh/src/exec/exec_destroy.c b/42sh/src/exec/exec_destroy.c index 1f9a068a..28f092f8 100644 --- a/42sh/src/exec/exec_destroy.c +++ b/42sh/src/exec/exec_destroy.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/08 14:31:42 by jhalford #+# #+# */ -/* Updated: 2017/03/26 21:56:52 by jhalford ### ########.fr */ +/* Updated: 2017/03/26 22:10:41 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -25,6 +25,5 @@ int exec_destroy(t_exec *exec) i = -1; while (++i < 10) ft_lstdel(&exec->fd_save[i], ft_lst_cfree); - exec_init(exec); return (0); } diff --git a/42sh/src/exec/exec_init.c b/42sh/src/exec/exec_init.c index 62aec97d..4bcae2d2 100644 --- a/42sh/src/exec/exec_init.c +++ b/42sh/src/exec/exec_init.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/26 21:28:09 by jhalford #+# #+# */ -/* Updated: 2017/03/26 21:59:23 by jhalford ### ########.fr */ +/* Updated: 2017/03/26 22:13:04 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -28,14 +28,14 @@ int exec_init(t_exec *exec) int i; jobc = &data_singleton()->jobc; + job_init(&exec->job); i = -1; while (++i < 10) exec->fd_save[i] = NULL; exec_pushfds(); - exec->op_stack = NULL; - exec->fdin = STDIN; exec->attrs = 0; - job_init(&exec->job); + exec->fdin = STDIN; + exec->op_stack = NULL; jobc->first_job = NULL; jobc->current_id = 1; return (0); diff --git a/42sh/src/exec/process_launch.c b/42sh/src/exec/process_launch.c index 6949e955..5dfe74fc 100644 --- a/42sh/src/exec/process_launch.c +++ b/42sh/src/exec/process_launch.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/13 22:21:19 by jhalford #+# #+# */ -/* Updated: 2017/03/26 21:50:39 by jhalford ### ########.fr */ +/* Updated: 2017/03/26 22:13:57 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -27,6 +27,7 @@ int process_fork(t_process *p) process_setgroup(p, 0); process_setsig(); exec_destroy(&data_singleton()->exec); + exec_init(&data_singleton()->exec); data_singleton()->opts &= ~SH_INTERACTIVE; data_singleton()->opts &= ~SH_OPTS_JOBC; exit(p->map.launch(p)); diff --git a/42sh/src/exec/process_set.c b/42sh/src/exec/process_set.c index be240f3f..42f94d69 100644 --- a/42sh/src/exec/process_set.c +++ b/42sh/src/exec/process_set.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/05 14:54:45 by jhalford #+# #+# */ -/* Updated: 2017/03/24 19:19:34 by jhalford ### ########.fr */ +/* Updated: 2017/03/26 22:14:09 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -30,10 +30,10 @@ static int process_set_spec(t_process *p, t_btree *ast) int i; t_astnode *item; - i = -1; if (!ast) return (0); item = ast->item; + i = -1; while (g_setprocessmap[++i].id) if (item->type == g_setprocessmap[i].id) { @@ -70,5 +70,5 @@ int process_set(t_process *p, t_btree *ast) if (ast) p->redirs = ft_lstmap( ((t_astnode *)ast->item)->data.cmd.redir, &redir_copy); - return ((!ast) ? 0 : process_set_spec(p, ast)); + return (process_set_spec(p, ast)); }