Merge branch 'pda' of github.com:jzck/42sh into pda
This commit is contained in:
commit
ec531721ea
15 changed files with 92 additions and 110 deletions
|
|
@ -71,6 +71,7 @@ exec/exec_leaf.c\
|
||||||
exec/exec_math.c\
|
exec/exec_math.c\
|
||||||
exec/exec_or_if.c\
|
exec/exec_or_if.c\
|
||||||
exec/exec_pipe.c\
|
exec/exec_pipe.c\
|
||||||
|
exec/exec_reset.c\
|
||||||
exec/exec_semi.c\
|
exec/exec_semi.c\
|
||||||
exec/exec_var.c\
|
exec/exec_var.c\
|
||||||
exec/fd_is_valid.c\
|
exec/fd_is_valid.c\
|
||||||
|
|
@ -91,7 +92,6 @@ exec/mark_process_status.c\
|
||||||
exec/node_copy.c\
|
exec/node_copy.c\
|
||||||
exec/process_redirect.c\
|
exec/process_redirect.c\
|
||||||
exec/process_reset.c\
|
exec/process_reset.c\
|
||||||
exec/process_setexec.c\
|
|
||||||
exec/process_setgroup.c\
|
exec/process_setgroup.c\
|
||||||
exec/process_setsig.c\
|
exec/process_setsig.c\
|
||||||
exec/redir_copy.c\
|
exec/redir_copy.c\
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/27 20:29:56 by jhalford #+# #+# */
|
/* Created: 2016/11/27 20:29:56 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/08 12:26:19 by jhalford ### ########.fr */
|
/* Updated: 2017/03/08 14:51:04 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -131,7 +131,8 @@ extern t_itof g_execmap[];
|
||||||
extern t_itof g_redirmap[];
|
extern t_itof g_redirmap[];
|
||||||
extern t_itof g_launchmap[];
|
extern t_itof g_launchmap[];
|
||||||
|
|
||||||
int process_setexec(t_process *p);
|
|
||||||
|
int exec_reset(void);
|
||||||
int process_setgroup(t_process *p, pid_t pid);
|
int process_setgroup(t_process *p, pid_t pid);
|
||||||
void process_setsig(void);
|
void process_setsig(void);
|
||||||
void process_reset(t_process *p);
|
void process_reset(t_process *p);
|
||||||
|
|
@ -190,6 +191,7 @@ int launch_function(t_process *p);
|
||||||
/*
|
/*
|
||||||
** Mapping pour set les process
|
** Mapping pour set les process
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int set_process(t_process *p, t_btree *ast);
|
int set_process(t_process *p, t_btree *ast);
|
||||||
int set_process_map(t_process *p, t_btree *ast, t_cmd *cmd);
|
int set_process_map(t_process *p, t_btree *ast, t_cmd *cmd);
|
||||||
int set_process_cmd(t_process *p, t_btree *ast, t_cmd *cmd);
|
int set_process_cmd(t_process *p, t_btree *ast, t_cmd *cmd);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/07 15:47:30 by wescande #+# #+# */
|
/* Created: 2017/03/07 15:47:30 by wescande #+# #+# */
|
||||||
/* Updated: 2017/03/08 11:50:20 by jhalford ### ########.fr */
|
/* Updated: 2017/03/08 14:47:30 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
31
42sh/src/exec/exec_reset.c
Normal file
31
42sh/src/exec/exec_reset.c
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* exec_reset.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2017/03/08 14:31:42 by jhalford #+# #+# */
|
||||||
|
/* Updated: 2017/03/08 14:45:10 by jhalford ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "minishell.h"
|
||||||
|
|
||||||
|
int exec_reset(void)
|
||||||
|
{
|
||||||
|
t_exec *exec;
|
||||||
|
|
||||||
|
exec = &data_singleton()->exec;
|
||||||
|
exec->fd_save[0] = fcntl(0, F_DUPFD_CLOEXEC);
|
||||||
|
exec->fd_save[1] = fcntl(1, F_DUPFD_CLOEXEC);
|
||||||
|
exec->fd_save[2] = fcntl(2, F_DUPFD_CLOEXEC);
|
||||||
|
exec->op_stack = NULL;
|
||||||
|
exec->fdin = STDIN;
|
||||||
|
exec->attrs = 0;
|
||||||
|
exec->job.id = 0;
|
||||||
|
exec->job.pgid = 0;
|
||||||
|
exec->job.attrs = 0;
|
||||||
|
exec->job.first_process = NULL;
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/07 15:48:24 by jhalford #+# #+# */
|
/* Created: 2017/03/07 15:48:24 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/08 13:04:29 by jhalford ### ########.fr */
|
/* Updated: 2017/03/08 14:43:35 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/07 14:53:31 by jhalford #+# #+# */
|
/* Created: 2017/03/07 14:53:31 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/08 12:42:22 by jhalford ### ########.fr */
|
/* Updated: 2017/03/08 14:46:08 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -40,10 +40,13 @@ int launch_file(t_process *p)
|
||||||
ft_dprintf(2, "{red}%s: permission denied: %s{eoc}\n", SHELL_NAME, p->data.cmd.av[0]);
|
ft_dprintf(2, "{red}%s: permission denied: %s{eoc}\n", SHELL_NAME, p->data.cmd.av[0]);
|
||||||
exit(126);
|
exit(126);
|
||||||
}
|
}
|
||||||
|
// for all leaves
|
||||||
process_setgroup(p, 0);
|
process_setgroup(p, 0);
|
||||||
process_setsig();
|
process_setsig();
|
||||||
if (process_redirect(p))
|
if (process_redirect(p))
|
||||||
exit (1);
|
exit (1);
|
||||||
|
exec_reset();
|
||||||
|
//
|
||||||
(*p->data.cmd.execf)(p->data.cmd.path, p->data.cmd.av, data_singleton()->env);
|
(*p->data.cmd.execf)(p->data.cmd.path, p->data.cmd.av, data_singleton()->env);
|
||||||
ft_dprintf(2, "{red}%s: internal execve error on %s{eoc}\n", SHELL_NAME, p->data.cmd.av[0]);
|
ft_dprintf(2, "{red}%s: internal execve error on %s{eoc}\n", SHELL_NAME, p->data.cmd.av[0]);
|
||||||
exit(42);
|
exit(42);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/13 14:20:45 by jhalford #+# #+# */
|
/* Created: 2016/12/13 14:20:45 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/08 14:26:41 by jhalford ### ########.fr */
|
/* Updated: 2017/03/08 14:45:54 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -28,7 +28,6 @@ t_itof g_launchmap[] =
|
||||||
|
|
||||||
int launch_process(t_process *p)
|
int launch_process(t_process *p)
|
||||||
{
|
{
|
||||||
// int i;
|
|
||||||
int pid;
|
int pid;
|
||||||
|
|
||||||
if (p->type >= PROCESS_MAX)
|
if (p->type >= PROCESS_MAX)
|
||||||
|
|
@ -42,25 +41,4 @@ int launch_process(t_process *p)
|
||||||
p->pid = pid;
|
p->pid = pid;
|
||||||
process_setgroup(p, pid);
|
process_setgroup(p, pid);
|
||||||
return (0);
|
return (0);
|
||||||
/*
|
|
||||||
i = 0;
|
|
||||||
while (g_launchmap[i].id)
|
|
||||||
{
|
|
||||||
if (p->type == g_launchmap[i].id)
|
|
||||||
{
|
|
||||||
if (!g_launchmap[i].f)
|
|
||||||
return (-1);
|
|
||||||
p->attrs &= ~PROCESS_STATE_MASK;
|
|
||||||
p->attrs |= PROCESS_RUNNING;
|
|
||||||
if ((pid = (*g_launchmap[i].f)(p)))
|
|
||||||
{
|
|
||||||
p->pid = pid;
|
|
||||||
process_setgroup(p, pid);
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
return (-1);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/08 00:11:44 by wescande #+# #+# */
|
/* Created: 2017/03/08 00:11:44 by wescande #+# #+# */
|
||||||
/* Updated: 2017/03/08 00:32:13 by wescande ### ########.fr */
|
/* Updated: 2017/03/08 14:44:57 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/07 17:44:22 by jhalford #+# #+# */
|
/* Created: 2017/02/07 17:44:22 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/07 14:36:21 by wescande ### ########.fr */
|
/* Updated: 2017/03/08 14:51:19 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -18,12 +18,10 @@ void process_reset(t_process *p)
|
||||||
// p->path = NULL;
|
// p->path = NULL;
|
||||||
// p->execf = NULL;
|
// p->execf = NULL;
|
||||||
p->pid = 0;
|
p->pid = 0;
|
||||||
/* p->fdin = STDIN; */
|
p->fdin = STDIN;
|
||||||
/* p->fdout = STDOUT; */
|
p->fdout = STDOUT;
|
||||||
p->to_close = 0;
|
p->to_close = 0;
|
||||||
p->redirs = NULL;
|
p->redirs = NULL;
|
||||||
p->status = -1;
|
p->status = -1;
|
||||||
p->attrs = 0;
|
p->attrs = 0;
|
||||||
// p->condition = NULL;
|
|
||||||
// p->content = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,52 +0,0 @@
|
||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* ::: :::::::: */
|
|
||||||
/* process_setexec.c :+: :+: :+: */
|
|
||||||
/* +:+ +:+ +:+ */
|
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
|
||||||
/* +#+#+#+#+#+ +#+ */
|
|
||||||
/* Created: 2016/12/13 17:07:10 by jhalford #+# #+# */
|
|
||||||
/* Updated: 2017/03/08 12:54:54 by jhalford ### ########.fr */
|
|
||||||
/* */
|
|
||||||
/* ************************************************************************** */
|
|
||||||
|
|
||||||
#include "minishell.h"
|
|
||||||
|
|
||||||
int process_setexec(t_process *p)
|
|
||||||
{
|
|
||||||
t_btree *func;
|
|
||||||
p->data.cmd.path = NULL;
|
|
||||||
p->data.cmd.execf = NULL;
|
|
||||||
p->data.cmd.stat = ft_memalloc(sizeof(struct stat));
|
|
||||||
DG("gonna setexec av[0]=[%s]", p->data.cmd.av[0]);
|
|
||||||
if ((func = is_function(p)))
|
|
||||||
{
|
|
||||||
p->data.subshell.content = func;
|
|
||||||
p->type = PROCESS_FUNCTION;
|
|
||||||
}
|
|
||||||
else if ((p->data.cmd.execf = is_builtin(p)))
|
|
||||||
p->type = PROCESS_BUILTIN;
|
|
||||||
else if (ft_strchr(p->data.cmd.av[0], '/'))
|
|
||||||
{
|
|
||||||
p->type = PROCESS_FILE;
|
|
||||||
p->data.cmd.execf = &execve;
|
|
||||||
p->data.cmd.path = ft_strdup(p->data.cmd.av[0]);
|
|
||||||
if (stat(p->data.cmd.path, p->data.cmd.stat) == -1)
|
|
||||||
ft_memdel((void**)&p->data.cmd.stat);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
p->type = PROCESS_FILE;
|
|
||||||
if (ft_hash(p))
|
|
||||||
{
|
|
||||||
p->data.cmd.execf = &execve;
|
|
||||||
DG("found hash at [%s]", p->data.cmd.path);
|
|
||||||
if (stat(p->data.cmd.path, p->data.cmd.stat) == -1)
|
|
||||||
{
|
|
||||||
ft_memdel((void**)&p->data.cmd.stat);
|
|
||||||
ft_dprintf(2, "{red}%s: %s: unexpected stat (2) failure\n", SHELL_NAME, p->data.cmd.path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/05 14:54:45 by jhalford #+# #+# */
|
/* Created: 2017/03/05 14:54:45 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/08 11:53:31 by jhalford ### ########.fr */
|
/* Updated: 2017/03/08 14:51:22 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -20,7 +20,7 @@ int set_process(t_process *p, t_btree *ast)
|
||||||
int fds[2];
|
int fds[2];
|
||||||
|
|
||||||
cmd = &((t_astnode *)ast->item)->data.cmd;
|
cmd = &((t_astnode *)ast->item)->data.cmd;
|
||||||
process_reset(p);
|
/* process_reset(p); */
|
||||||
exec = &data_singleton()->exec;
|
exec = &data_singleton()->exec;
|
||||||
op = pop(&exec->op_stack);
|
op = pop(&exec->op_stack);
|
||||||
if ((EXEC_IS_AND_IF(exec->attrs)
|
if ((EXEC_IS_AND_IF(exec->attrs)
|
||||||
|
|
@ -39,7 +39,5 @@ int set_process(t_process *p, t_btree *ast)
|
||||||
p->fdout = fds[PIPE_WRITE];
|
p->fdout = fds[PIPE_WRITE];
|
||||||
exec->fdin = fds[PIPE_READ];
|
exec->fdin = fds[PIPE_READ];
|
||||||
p->redirs = ft_lstmap(cmd->redir, &redir_copy);
|
p->redirs = ft_lstmap(cmd->redir, &redir_copy);
|
||||||
if (set_process_map(p, ast, cmd))
|
return (set_process_map(p, ast, cmd));
|
||||||
return (1);
|
|
||||||
return (0);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/07 15:06:05 by wescande #+# #+# */
|
/* Created: 2017/03/07 15:06:05 by wescande #+# #+# */
|
||||||
/* Updated: 2017/03/08 11:49:32 by jhalford ### ########.fr */
|
/* Updated: 2017/03/08 14:46:10 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -14,9 +14,43 @@
|
||||||
|
|
||||||
int set_process_cmd(t_process *p, t_btree *ast, t_cmd *cmd)
|
int set_process_cmd(t_process *p, t_btree *ast, t_cmd *cmd)
|
||||||
{
|
{
|
||||||
|
t_btree *func;
|
||||||
|
|
||||||
(void)ast;
|
(void)ast;
|
||||||
if (!(p->data.cmd.av = token_to_argv(cmd->token, 1)))
|
if (!(p->data.cmd.av = token_to_argv(cmd->token, 1)))
|
||||||
return (1);
|
return (1);
|
||||||
process_setexec(p);
|
p->data.cmd.path = NULL;
|
||||||
|
p->data.cmd.execf = NULL;
|
||||||
|
p->data.cmd.stat = ft_memalloc(sizeof(struct stat));
|
||||||
|
DG("gonna setexec av[0]=[%s]", p->data.cmd.av[0]);
|
||||||
|
if ((func = is_function(p)))
|
||||||
|
{
|
||||||
|
p->data.subshell.content = func;
|
||||||
|
p->type = PROCESS_FUNCTION;
|
||||||
|
}
|
||||||
|
else if ((p->data.cmd.execf = is_builtin(p)))
|
||||||
|
p->type = PROCESS_BUILTIN;
|
||||||
|
else if (ft_strchr(p->data.cmd.av[0], '/'))
|
||||||
|
{
|
||||||
|
p->type = PROCESS_FILE;
|
||||||
|
p->data.cmd.execf = &execve;
|
||||||
|
p->data.cmd.path = ft_strdup(p->data.cmd.av[0]);
|
||||||
|
if (stat(p->data.cmd.path, p->data.cmd.stat) == -1)
|
||||||
|
ft_memdel((void**)&p->data.cmd.stat);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p->type = PROCESS_FILE;
|
||||||
|
if (ft_hash(p))
|
||||||
|
{
|
||||||
|
p->data.cmd.execf = &execve;
|
||||||
|
DG("found hash at [%s]", p->data.cmd.path);
|
||||||
|
if (stat(p->data.cmd.path, p->data.cmd.stat) == -1)
|
||||||
|
{
|
||||||
|
ft_memdel((void**)&p->data.cmd.stat);
|
||||||
|
ft_dprintf(2, "{red}%s: %s: unexpected stat (2) failure\n", SHELL_NAME, p->data.cmd.path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/07 15:08:12 by wescande #+# #+# */
|
/* Created: 2017/03/07 15:08:12 by wescande #+# #+# */
|
||||||
/* Updated: 2017/03/08 11:50:08 by jhalford ### ########.fr */
|
/* Updated: 2017/03/08 14:48:02 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -48,8 +48,8 @@ int set_process_map(t_process *p, t_btree *ast, t_cmd *cmd)
|
||||||
if (item->type == g_setprocessmap[i].id)
|
if (item->type == g_setprocessmap[i].id)
|
||||||
{
|
{
|
||||||
if (!g_setprocessmap[i].f)
|
if (!g_setprocessmap[i].f)
|
||||||
return (0);
|
return (1);
|
||||||
return ((*g_setprocessmap[i].f)(p, ast, cmd));
|
return ((*g_setprocessmap[i].f)(p, ast, cmd));
|
||||||
}
|
}
|
||||||
return (0);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/28 19:26:32 by jhalford #+# #+# */
|
/* Created: 2016/11/28 19:26:32 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/08 14:26:44 by jhalford ### ########.fr */
|
/* Updated: 2017/03/08 14:39:07 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -24,17 +24,7 @@ int data_init(void)
|
||||||
set_exitstatus(0, 1);
|
set_exitstatus(0, 1);
|
||||||
data->comp = NULL;
|
data->comp = NULL;
|
||||||
data->opts = 0;
|
data->opts = 0;
|
||||||
data->exec.fd_save[0] = fcntl(0, F_DUPFD_CLOEXEC);
|
exec_reset();
|
||||||
data->exec.fd_save[1] = fcntl(1, F_DUPFD_CLOEXEC);
|
|
||||||
data->exec.fd_save[2] = fcntl(2, F_DUPFD_CLOEXEC);
|
|
||||||
data->exec.op_stack = NULL;
|
|
||||||
data->exec.fdin = STDIN;
|
|
||||||
data->exec.attrs = 0;
|
|
||||||
|
|
||||||
data->exec.job.id = 0;
|
|
||||||
data->exec.job.pgid = 0;
|
|
||||||
data->exec.job.attrs = 0;
|
|
||||||
data->exec.job.first_process = NULL;
|
|
||||||
|
|
||||||
data->jobc.first_job = NULL;
|
data->jobc.first_job = NULL;
|
||||||
data->jobc.current_id = 1;
|
data->jobc.current_id = 1;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */
|
/* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/08 13:27:47 by jhalford ### ########.fr */
|
/* Updated: 2017/03/08 14:39:33 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue