commit
646a9cd430
6 changed files with 14 additions and 14 deletions
|
|
@ -6,14 +6,14 @@
|
||||||
# By: wescande <wescande@student.42.fr> +#+ +:+ +#+ #
|
# By: wescande <wescande@student.42.fr> +#+ +:+ +#+ #
|
||||||
# +#+#+#+#+#+ +#+ #
|
# +#+#+#+#+#+ +#+ #
|
||||||
# Created: 2016/08/29 21:32:58 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
|
NAME = 42sh
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
FLAGS = -Wall -Wextra -Werror -fsanitize=address#-fvisibility=hidden
|
FLAGS = -Wall -Wextra -Werror
|
||||||
D_FLAGS = -g
|
D_FLAGS = -g
|
||||||
|
|
||||||
DELTA = $$(echo "$$(tput cols)-47"|bc)
|
DELTA = $$(echo "$$(tput cols)-47"|bc)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/04 11:09:56 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;
|
t_list *top;
|
||||||
int item;
|
int item;
|
||||||
|
|
||||||
if (!(lst || *lst))
|
if (!(lst && *lst))
|
||||||
return (0);
|
return (0);
|
||||||
top = *lst;
|
top = *lst;
|
||||||
item = top ? *(int*)top->content : 0;
|
item = top ? *(int*)top->content : 0;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/08 14:31:42 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;
|
i = -1;
|
||||||
while (++i < 10)
|
while (++i < 10)
|
||||||
ft_lstdel(&exec->fd_save[i], ft_lst_cfree);
|
ft_lstdel(&exec->fd_save[i], ft_lst_cfree);
|
||||||
exec_init(exec);
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/26 21:28:09 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;
|
int i;
|
||||||
|
|
||||||
jobc = &data_singleton()->jobc;
|
jobc = &data_singleton()->jobc;
|
||||||
|
job_init(&exec->job);
|
||||||
i = -1;
|
i = -1;
|
||||||
while (++i < 10)
|
while (++i < 10)
|
||||||
exec->fd_save[i] = NULL;
|
exec->fd_save[i] = NULL;
|
||||||
exec_pushfds();
|
exec_pushfds();
|
||||||
exec->op_stack = NULL;
|
|
||||||
exec->fdin = STDIN;
|
|
||||||
exec->attrs = 0;
|
exec->attrs = 0;
|
||||||
job_init(&exec->job);
|
exec->fdin = STDIN;
|
||||||
|
exec->op_stack = NULL;
|
||||||
jobc->first_job = NULL;
|
jobc->first_job = NULL;
|
||||||
jobc->current_id = 1;
|
jobc->current_id = 1;
|
||||||
return (0);
|
return (0);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/13 22:21:19 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_setgroup(p, 0);
|
||||||
process_setsig();
|
process_setsig();
|
||||||
exec_destroy(&data_singleton()->exec);
|
exec_destroy(&data_singleton()->exec);
|
||||||
|
exec_init(&data_singleton()->exec);
|
||||||
data_singleton()->opts &= ~SH_INTERACTIVE;
|
data_singleton()->opts &= ~SH_INTERACTIVE;
|
||||||
data_singleton()->opts &= ~SH_OPTS_JOBC;
|
data_singleton()->opts &= ~SH_OPTS_JOBC;
|
||||||
exit(p->map.launch(p));
|
exit(p->map.launch(p));
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/05 14:54:45 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;
|
int i;
|
||||||
t_astnode *item;
|
t_astnode *item;
|
||||||
|
|
||||||
i = -1;
|
|
||||||
if (!ast)
|
if (!ast)
|
||||||
return (0);
|
return (0);
|
||||||
item = ast->item;
|
item = ast->item;
|
||||||
|
i = -1;
|
||||||
while (g_setprocessmap[++i].id)
|
while (g_setprocessmap[++i].id)
|
||||||
if (item->type == 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)
|
if (ast)
|
||||||
p->redirs = ft_lstmap(
|
p->redirs = ft_lstmap(
|
||||||
((t_astnode *)ast->item)->data.cmd.redir, &redir_copy);
|
((t_astnode *)ast->item)->data.cmd.redir, &redir_copy);
|
||||||
return ((!ast) ? 0 : process_set_spec(p, ast));
|
return (process_set_spec(p, ast));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue