working but no subshell
This commit is contained in:
parent
26222441cc
commit
3a186407b1
14 changed files with 149 additions and 28 deletions
|
|
@ -86,6 +86,7 @@ exec/launch_file.c\
|
||||||
exec/launch_for.c\
|
exec/launch_for.c\
|
||||||
exec/launch_if.c\
|
exec/launch_if.c\
|
||||||
exec/launch_process.c\
|
exec/launch_process.c\
|
||||||
|
exec/launch_subshell.c\
|
||||||
exec/launch_until.c\
|
exec/launch_until.c\
|
||||||
exec/launch_while.c\
|
exec/launch_while.c\
|
||||||
exec/mark_process_status.c\
|
exec/mark_process_status.c\
|
||||||
|
|
@ -108,6 +109,7 @@ exec/set_process_cmd.c\
|
||||||
exec/set_process_for.c\
|
exec/set_process_for.c\
|
||||||
exec/set_process_if.c\
|
exec/set_process_if.c\
|
||||||
exec/set_process_map.c\
|
exec/set_process_map.c\
|
||||||
|
exec/set_process_subshell.c\
|
||||||
exec/set_process_until.c\
|
exec/set_process_until.c\
|
||||||
exec/set_process_while.c\
|
exec/set_process_while.c\
|
||||||
exec/token_to_argv.c\
|
exec/token_to_argv.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/07 22:23:06 by wescande ### ########.fr */
|
/* Updated: 2017/03/08 01:04:12 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -65,9 +65,15 @@ struct s_data_list
|
||||||
t_btree *content;
|
t_btree *content;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct s_data_subshell
|
||||||
|
{
|
||||||
|
t_btree *content;
|
||||||
|
};
|
||||||
|
|
||||||
union u_process_data
|
union u_process_data
|
||||||
{
|
{
|
||||||
struct s_data_cmd cmd;
|
struct s_data_cmd cmd;
|
||||||
|
struct s_data_subshell subshell;
|
||||||
struct s_data_cond d_while;
|
struct s_data_cond d_while;
|
||||||
struct s_data_cond d_if;
|
struct s_data_cond d_if;
|
||||||
struct s_data_cond d_else;
|
struct s_data_cond d_else;
|
||||||
|
|
@ -94,6 +100,7 @@ typedef enum e_process_type t_process_type;
|
||||||
typedef union u_process_data t_process_data;
|
typedef union u_process_data t_process_data;
|
||||||
typedef struct s_data_cond t_data_while;
|
typedef struct s_data_cond t_data_while;
|
||||||
typedef struct s_data_cond t_data_if;
|
typedef struct s_data_cond t_data_if;
|
||||||
|
typedef struct s_data_cond t_data_if;
|
||||||
|
|
||||||
struct s_process
|
struct s_process
|
||||||
{
|
{
|
||||||
|
|
@ -152,7 +159,6 @@ int exec_math(t_btree **ast);
|
||||||
int process_setexec(t_process *p);
|
int process_setexec(t_process *p);
|
||||||
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_free(void *content, size_t content_size);
|
|
||||||
void process_reset(t_process *p);
|
void process_reset(t_process *p);
|
||||||
void process_resetfds(void);
|
void process_resetfds(void);
|
||||||
|
|
||||||
|
|
@ -180,6 +186,12 @@ int add_new_job(t_job *job);
|
||||||
|
|
||||||
int error_badidentifier(char *name);
|
int error_badidentifier(char *name);
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Mapping pour free les process
|
||||||
|
*/
|
||||||
|
void process_free(void *content, size_t content_size);
|
||||||
|
void process_free_cmd(t_process *p);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Mapping pour launch les process
|
** Mapping pour launch les process
|
||||||
*/
|
*/
|
||||||
|
|
@ -191,6 +203,7 @@ int launch_for(t_process *p);
|
||||||
int launch_case(t_process *p);
|
int launch_case(t_process *p);
|
||||||
int launch_file(t_process *p);
|
int launch_file(t_process *p);
|
||||||
int launch_builtin(t_process *p);
|
int launch_builtin(t_process *p);
|
||||||
|
int launch_subshell(t_process *p);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Mapping pour set les process
|
** Mapping pour set les process
|
||||||
|
|
@ -203,4 +216,6 @@ int set_process_until(t_process *p, t_btree *ast, t_cmd *cmd);
|
||||||
int set_process_if(t_process *p, t_btree *ast, t_cmd *cmd);
|
int set_process_if(t_process *p, t_btree *ast, t_cmd *cmd);
|
||||||
int set_process_for(t_process *p, t_btree *ast, t_cmd *cmd);
|
int set_process_for(t_process *p, t_btree *ast, t_cmd *cmd);
|
||||||
int set_process_case(t_process *p, t_btree *ast, t_cmd *cmd);
|
int set_process_case(t_process *p, t_btree *ast, t_cmd *cmd);
|
||||||
|
int set_process_subshell(t_process *p, t_btree *ast, t_cmd *cmd);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/13 17:11:48 by jhalford #+# #+# */
|
/* Created: 2016/12/13 17:11:48 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/07 20:57:19 by wescande ### ########.fr */
|
/* Updated: 2017/03/08 00:22:56 by wescande ### ########.fr */
|
||||||
/* Updated: 2017/03/07 18:35:11 by jhalford ### ########.fr */
|
/* Updated: 2017/03/07 18:35:11 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
@ -118,7 +118,6 @@ enum e_sym
|
||||||
TK_IO_NUMBER,
|
TK_IO_NUMBER,
|
||||||
TK_DLESSDASH,
|
TK_DLESSDASH,
|
||||||
TK_LESSGREAT,
|
TK_LESSGREAT,
|
||||||
TK_SUBSHELL,
|
|
||||||
TK_CASE,
|
TK_CASE,
|
||||||
TK_IN,
|
TK_IN,
|
||||||
TK_ESAC,
|
TK_ESAC,
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/27 20:30:32 by jhalford #+# #+# */
|
/* Created: 2016/11/27 20:30:32 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/07 20:54:28 by wescande ### ########.fr */
|
/* Updated: 2017/03/08 00:21:22 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -30,7 +30,7 @@ t_itof g_execmap[] =
|
||||||
{TK_PAREN_OPEN, &exec_case_branch},
|
{TK_PAREN_OPEN, &exec_case_branch},
|
||||||
{TK_ASSIGNEMENT_WORD, &exec_var},
|
{TK_ASSIGNEMENT_WORD, &exec_var},
|
||||||
{MATH, &exec_math},
|
{MATH, &exec_math},
|
||||||
/* {TK_SUBSHELL, &exec_leaf}, */
|
{SUBSHELL, &exec_leaf},
|
||||||
{CMD, &exec_leaf},
|
{CMD, &exec_leaf},
|
||||||
{0, 0},
|
{0, 0},
|
||||||
};
|
};
|
||||||
|
|
@ -44,6 +44,7 @@ int ft_exec(t_btree **ast)
|
||||||
if (!*ast)
|
if (!*ast)
|
||||||
return (0);
|
return (0);
|
||||||
item = (*ast)->item;
|
item = (*ast)->item;
|
||||||
|
DG("COMPARE : %d vs %d (SUBSHEELLL)", item->type, SUBSHELL);
|
||||||
while (g_execmap[i].id)
|
while (g_execmap[i].id)
|
||||||
{
|
{
|
||||||
if (item->type == g_execmap[i].id)
|
if (item->type == g_execmap[i].id)
|
||||||
|
|
|
||||||
|
|
@ -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/07 22:21:07 by wescande ### ########.fr */
|
/* Updated: 2017/03/08 00:11:15 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -17,7 +17,7 @@ t_itof g_launchmap[] =
|
||||||
{PROCESS_FUNCTION, NULL},
|
{PROCESS_FUNCTION, NULL},
|
||||||
{PROCESS_BUILTIN, launch_builtin},
|
{PROCESS_BUILTIN, launch_builtin},
|
||||||
{PROCESS_FILE, launch_file},
|
{PROCESS_FILE, launch_file},
|
||||||
{PROCESS_SUBSHELL, NULL},
|
{PROCESS_SUBSHELL, launch_subshell},
|
||||||
{PROCESS_WHILE, launch_while},
|
{PROCESS_WHILE, launch_while},
|
||||||
{PROCESS_UNTIL, launch_until},
|
{PROCESS_UNTIL, launch_until},
|
||||||
{PROCESS_IF, launch_if},
|
{PROCESS_IF, launch_if},
|
||||||
|
|
|
||||||
40
42sh/src/exec/launch_subshell.c
Normal file
40
42sh/src/exec/launch_subshell.c
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* launch_subshell.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2017/03/08 00:11:44 by wescande #+# #+# */
|
||||||
|
/* Updated: 2017/03/08 00:32:13 by wescande ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "minishell.h"
|
||||||
|
|
||||||
|
static int do_subshell(t_process *p)
|
||||||
|
{
|
||||||
|
ft_exec(&p->data.subshell.content);
|
||||||
|
return (ft_atoi(ft_getenv(data_singleton()->env, "?")));
|
||||||
|
}
|
||||||
|
|
||||||
|
int launch_subshell(t_process *p)
|
||||||
|
{
|
||||||
|
pid_t pid;
|
||||||
|
|
||||||
|
if (SH_IS_INTERACTIVE(data_singleton()->opts))
|
||||||
|
{
|
||||||
|
pid = fork();
|
||||||
|
if (pid == 0)
|
||||||
|
{
|
||||||
|
data_singleton()->opts &= ~SH_INTERACTIVE;
|
||||||
|
data_singleton()->opts &= ~SH_OPTS_JOBC;
|
||||||
|
exit(do_subshell(p));
|
||||||
|
}
|
||||||
|
else if (pid > 0)
|
||||||
|
return (pid);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
do_subshell(p);
|
||||||
|
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/07 22:24:21 by wescande ### ########.fr */
|
/* Updated: 2017/03/08 00:23:22 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -30,7 +30,7 @@ t_itof g_setprocessmap[] =
|
||||||
{TK_PAREN_OPEN, NULL},
|
{TK_PAREN_OPEN, NULL},
|
||||||
{TK_ASSIGNEMENT_WORD, NULL},
|
{TK_ASSIGNEMENT_WORD, NULL},
|
||||||
{MATH, NULL},
|
{MATH, NULL},
|
||||||
/* {TK_SUBSHELL, &exec_}, */
|
{SUBSHELL, &set_process_subshell},
|
||||||
{CMD, &set_process_cmd},
|
{CMD, &set_process_cmd},
|
||||||
{0, NULL}
|
{0, NULL}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
21
42sh/src/exec/set_process_subshell.c
Normal file
21
42sh/src/exec/set_process_subshell.c
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* set_process_sub.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2017/03/08 00:02:01 by wescande #+# #+# */
|
||||||
|
/* Updated: 2017/03/08 00:14:44 by wescande ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "minishell.h"
|
||||||
|
|
||||||
|
int set_process_subshell(t_process *p, t_btree *ast, t_cmd *cmd)
|
||||||
|
{
|
||||||
|
(void)cmd;
|
||||||
|
p->data.subshell.content = ast_copy(ast->right);
|
||||||
|
p->type = PROCESS_SUBSHELL;
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/12 14:01:59 by jhalford #+# #+# */
|
/* Created: 2017/01/12 14:01:59 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/05 18:07:24 by jhalford ### ########.fr */
|
/* Updated: 2017/03/08 00:24:07 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -26,7 +26,7 @@ char *command_getoutput(char *command)
|
||||||
|
|
||||||
/* output = NULL; */
|
/* output = NULL; */
|
||||||
/* exec = &data_singleton()->exec; */
|
/* exec = &data_singleton()->exec; */
|
||||||
/* item.type = TK_SUBSHELL; */
|
/* item.type = SUBSHELL; */
|
||||||
/* item.data.sstr = malloc(4 * sizeof(char *)); */
|
/* item.data.sstr = malloc(4 * sizeof(char *)); */
|
||||||
/* item.data.sstr[0] = ft_strdup(data_singleton()->argv[0]); */
|
/* item.data.sstr[0] = ft_strdup(data_singleton()->argv[0]); */
|
||||||
/* item.data.sstr[1] = ft_strdup("-c"); */
|
/* item.data.sstr[1] = ft_strdup("-c"); */
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/15 12:51:08 by jhalford #+# #+# */
|
/* Created: 2016/12/15 12:51:08 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/03 18:53:32 by jhalford ### ########.fr */
|
/* Updated: 2017/03/08 00:36:12 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -22,6 +22,7 @@ void job_remove(int id)
|
||||||
j = ft_lst_find(jobc->first_job, &id, job_cmp_id)->content;
|
j = ft_lst_find(jobc->first_job, &id, job_cmp_id)->content;
|
||||||
if (job_is_completed(id))
|
if (job_is_completed(id))
|
||||||
{
|
{
|
||||||
|
DG();
|
||||||
p = ft_lstlast(j->first_process)->content;
|
p = ft_lstlast(j->first_process)->content;
|
||||||
set_exitstatus(p->status, 0);
|
set_exitstatus(p->status, 0);
|
||||||
if (id < data_singleton()->jobc.current_id)
|
if (id < data_singleton()->jobc.current_id)
|
||||||
|
|
|
||||||
|
|
@ -6,20 +6,37 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/12 12:41:11 by jhalford #+# #+# */
|
/* Created: 2016/12/12 12:41:11 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/07 14:46:41 by wescande ### ########.fr */
|
/* Updated: 2017/03/08 01:38:58 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "minishell.h"
|
#include "minishell.h"
|
||||||
|
|
||||||
|
t_itof g_freemap[] =
|
||||||
|
{
|
||||||
|
{PROCESS_FUNCTION, NULL},
|
||||||
|
{PROCESS_BUILTIN, NULL},
|
||||||
|
{PROCESS_FILE, process_free_cmd},
|
||||||
|
{PROCESS_SUBSHELL, NULL},
|
||||||
|
{PROCESS_WHILE, NULL},
|
||||||
|
{PROCESS_UNTIL, NULL},
|
||||||
|
{PROCESS_IF, NULL},
|
||||||
|
{PROCESS_FOR, NULL},
|
||||||
|
{PROCESS_CASE, NULL},
|
||||||
|
{0, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
void process_free(void *content, size_t content_size)
|
void process_free(void *content, size_t content_size)
|
||||||
{
|
{
|
||||||
t_process *p;
|
t_process *p;
|
||||||
|
|
||||||
(void)content_size;
|
|
||||||
p = content;
|
p = content;
|
||||||
ft_strdel(&p->data.cmd.path);
|
(void)content_size;
|
||||||
ft_sstrfree(p->data.cmd.av);
|
if (p->type >= PROCESS_MAX)
|
||||||
|
return ;
|
||||||
|
if (!g_launchmap[p->type].f)
|
||||||
|
return ;
|
||||||
|
(g_freemap[p->type].f)(p);
|
||||||
ft_lstdel(&p->redirs, ft_lst_cfree);
|
ft_lstdel(&p->redirs, ft_lst_cfree);
|
||||||
free(p);
|
free(p);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
19
42sh/src/job-control/process_free_cmd.c
Normal file
19
42sh/src/job-control/process_free_cmd.c
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* process_free_cmd.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2017/03/08 00:58:02 by wescande #+# #+# */
|
||||||
|
/* Updated: 2017/03/08 00:59:38 by wescande ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "minishell.h"
|
||||||
|
|
||||||
|
void process_free_cmd(t_process *p)
|
||||||
|
{
|
||||||
|
ft_strdel(&p->data.cmd.path);
|
||||||
|
ft_sstrfree(p->data.cmd.av);
|
||||||
|
}
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/13 14:58:36 by jhalford #+# #+# */
|
/* Created: 2016/12/13 14:58:36 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/03 19:46:03 by jhalford ### ########.fr */
|
/* Updated: 2017/03/08 00:35:38 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -26,8 +26,11 @@ int put_job_in_foreground(t_job *j, int cont)
|
||||||
if (kill(-j->pgid, SIGCONT) < 0)
|
if (kill(-j->pgid, SIGCONT) < 0)
|
||||||
DG("kill(SIGCONT) failed");
|
DG("kill(SIGCONT) failed");
|
||||||
}
|
}
|
||||||
|
DG();
|
||||||
job_wait(j->id);
|
job_wait(j->id);
|
||||||
|
DG();
|
||||||
job_remove(j->id);
|
job_remove(j->id);
|
||||||
|
DG();
|
||||||
|
|
||||||
tcsetpgrp(STDIN, jobc->shell_pgid);
|
tcsetpgrp(STDIN, jobc->shell_pgid);
|
||||||
|
|
||||||
|
|
@ -36,8 +39,11 @@ int put_job_in_foreground(t_job *j, int cont)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
DG();
|
||||||
job_wait(j->id);
|
job_wait(j->id);
|
||||||
|
DG();
|
||||||
job_remove(j->id);
|
job_remove(j->id);
|
||||||
|
DG();
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
/* By: ariard <ariard@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/09 15:32:10 by ariard #+# #+# */
|
/* Created: 2017/02/09 15:32:10 by ariard #+# #+# */
|
||||||
/* Updated: 2017/03/03 20:03:24 by ariard ### ########.fr */
|
/* Updated: 2017/03/08 00:23:48 by wescande ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -146,8 +146,8 @@ char *read_state(t_sym current)
|
||||||
return ("TK_LESSAND");
|
return ("TK_LESSAND");
|
||||||
if (current == TK_GREATAND)
|
if (current == TK_GREATAND)
|
||||||
return ("TK_GREATAND");
|
return ("TK_GREATAND");
|
||||||
if (current == TK_SUBSHELL)
|
if (current == SUBSHELL)
|
||||||
return ("TK_SUBSEHLL");
|
return ("SUBSEHLL");
|
||||||
if (current == CMD_SUPERIOR)
|
if (current == CMD_SUPERIOR)
|
||||||
return ("CMD_SUPERIOR");
|
return ("CMD_SUPERIOR");
|
||||||
if (current == TK_IO_NUMBER)
|
if (current == TK_IO_NUMBER)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue