merge
This commit is contained in:
commit
c5c47df5ea
7 changed files with 35 additions and 17 deletions
|
|
@ -196,6 +196,7 @@ job_control/job_run.c\
|
||||||
job_control/job_update_id.c\
|
job_control/job_update_id.c\
|
||||||
job_control/job_update_status.c\
|
job_control/job_update_status.c\
|
||||||
job_control/job_wait.c\
|
job_control/job_wait.c\
|
||||||
|
job_control/jobc_destroy.c\
|
||||||
job_control/mark_job_as_running.c\
|
job_control/mark_job_as_running.c\
|
||||||
job_control/pprint_brace.c\
|
job_control/pprint_brace.c\
|
||||||
job_control/pprint_case.c\
|
job_control/pprint_case.c\
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/10 16:55:09 by jhalford #+# #+# */
|
/* Created: 2016/12/10 16:55:09 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/24 16:17:40 by gwojda ### ########.fr */
|
/* Updated: 2017/03/27 03:11:08 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -35,6 +35,8 @@ struct s_jobc
|
||||||
struct termios shell_tmodes;
|
struct termios shell_tmodes;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int jobc_destroy(t_jobc *jobc);
|
||||||
|
|
||||||
t_list *job_getprocess(pid_t pid);
|
t_list *job_getprocess(pid_t pid);
|
||||||
int job_addprocess(t_process *p);
|
int job_addprocess(t_process *p);
|
||||||
void job_update_id(void);
|
void job_update_id(void);
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
/* */
|
/* */
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* exec_reset.c :+: :+: :+: */
|
/* exec_destroy.c :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/08 14:31:42 by jhalford #+# #+# */
|
/* Created: 2017/03/27 03:09:58 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/27 00:33:31 by jhalford ### ########.fr */
|
/* Updated: 2017/03/27 03:10:37 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -14,14 +14,8 @@
|
||||||
|
|
||||||
int exec_destroy(t_exec *exec)
|
int exec_destroy(t_exec *exec)
|
||||||
{
|
{
|
||||||
t_jobc *jobc;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (!exec)
|
if (!exec)
|
||||||
return (0);
|
return (0);
|
||||||
jobc = &data_singleton()->jobc;
|
|
||||||
ft_lstdel(&exec->op_stack, ft_lst_cfree);
|
ft_lstdel(&exec->op_stack, ft_lst_cfree);
|
||||||
ft_lstdel(&jobc->first_job, job_free);
|
|
||||||
i = -1;
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* 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/24 17:28:45 by jhalford ### ########.fr */
|
/* Updated: 2017/03/27 03:08:10 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -35,6 +35,6 @@ int mark_process_status(pid_t pid, int status)
|
||||||
}
|
}
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
SH_ERR("No child process %d", pid);
|
SH_ERR("No child process %i", pid);
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/15 12:56:11 by jhalford #+# #+# */
|
/* Created: 2016/12/15 12:56:11 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/20 14:36:02 by jhalford ### ########.fr */
|
/* Updated: 2017/03/27 03:07:57 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -21,8 +21,8 @@ void job_update_status(void)
|
||||||
{
|
{
|
||||||
if ((pid = waitpid(WAIT_ANY, &status, WUNTRACED | WNOHANG)) == -1
|
if ((pid = waitpid(WAIT_ANY, &status, WUNTRACED | WNOHANG)) == -1
|
||||||
&& errno != ECHILD)
|
&& errno != ECHILD)
|
||||||
ft_dprintf(2, "{red}%s: waitpid error errno=%i{eoc}\n",
|
SH_ERR("waitpid(): %s", strerror(errno));
|
||||||
SHELL_NAME, errno);
|
DG("wait trigger pid=%i", pid);
|
||||||
if (pid <= 1 || mark_process_status(pid, status))
|
if (pid <= 1 || mark_process_status(pid, status))
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
20
42sh/src/job_control/jobc_destroy.c
Normal file
20
42sh/src/job_control/jobc_destroy.c
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
/* ************************************************************************** */
|
||||||
|
/* */
|
||||||
|
/* ::: :::::::: */
|
||||||
|
/* jobc_destroy.c :+: :+: :+: */
|
||||||
|
/* +:+ +:+ +:+ */
|
||||||
|
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||||
|
/* +#+#+#+#+#+ +#+ */
|
||||||
|
/* Created: 2017/03/27 03:09:41 by jhalford #+# #+# */
|
||||||
|
/* Updated: 2017/03/27 03:10:55 by jhalford ### ########.fr */
|
||||||
|
/* */
|
||||||
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
#include "minishell.h"
|
||||||
|
|
||||||
|
int jobc_destroy(t_jobc *jobc)
|
||||||
|
{
|
||||||
|
if (jobc)
|
||||||
|
ft_lstdel(&jobc->first_job, job_free);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/07 18:07:50 by jhalford #+# #+# */
|
/* Created: 2016/12/07 18:07:50 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/27 02:55:04 by jhalford ### ########.fr */
|
/* Updated: 2017/03/27 03:12:52 by jhalford ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -25,6 +25,7 @@ void data_exit(void)
|
||||||
lexer_destroy(&data->lexer);
|
lexer_destroy(&data->lexer);
|
||||||
parser_destroy(&data->parser);
|
parser_destroy(&data->parser);
|
||||||
exec_destroy(&data->exec);
|
exec_destroy(&data->exec);
|
||||||
|
jobc_destroy(&data->jobc);
|
||||||
i = -1;
|
i = -1;
|
||||||
while (++i < 10)
|
while (++i < 10)
|
||||||
ft_lstdel(&data->exec.fd_save[i], ft_lst_cfree);
|
ft_lstdel(&data->exec.fd_save[i], ft_lst_cfree);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue