plein de headers mis a jour avec mon nom

This commit is contained in:
Jack Halford 2017-03-17 22:59:56 +01:00
parent 6f4ecd2960
commit 4524fac2c8
6 changed files with 23 additions and 17 deletions

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */ /* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/07 13:49:04 by jhalford #+# #+# */ /* Created: 2016/11/07 13:49:04 by jhalford #+# #+# */
/* Updated: 2017/03/15 20:51:55 by ariard ### ########.fr */ /* Updated: 2017/03/17 21:30:29 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */ /* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/07 13:33:27 by jhalford #+# #+# */ /* Created: 2016/11/07 13:33:27 by jhalford #+# #+# */
/* Updated: 2017/03/14 20:24:44 by jhalford ### ########.fr */ /* Updated: 2017/03/17 21:33:37 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -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/16 23:00:36 by jhalford ### ########.fr */ /* Updated: 2017/03/17 21:38:46 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -30,9 +30,10 @@ int mark_process_status(pid_t pid, int status)
{ {
p->attrs &= ~PROCESS_STATE_MASK; p->attrs &= ~PROCESS_STATE_MASK;
p->attrs |= PROCESS_COMPLETED; p->attrs |= PROCESS_COMPLETED;
if (WIFSIGNALED(status) && DEBUG_MODE) if (WIFSIGNALED(status))
ft_printf("{mag}%d: Terminated by signal %d.\n{eoc}", psignal(WTERMSIG(status), NULL);
(int)pid, WTERMSIG(status)); /* ft_printf("{mag}%d: Terminated by signal %d.\n{eoc}", */
/* (int)pid, WTERMSIG(status)); */
} }
return (0); return (0);
} }

View file

@ -6,7 +6,7 @@
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */ /* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/09 13:05:55 by jhalford #+# #+# */ /* Created: 2017/01/09 13:05:55 by jhalford #+# #+# */
/* Updated: 2017/03/16 16:41:10 by jhalford ### ########.fr */ /* Updated: 2017/03/17 21:35:27 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -35,26 +35,31 @@ static int redirection_print(t_redir *redir)
static void process_format_state(t_process *p) static void process_format_state(t_process *p)
{ {
int state; int state;
char *statestr;
state = p->attrs & PROCESS_STATE_MASK; state = p->attrs & PROCESS_STATE_MASK;
statestr = NULL;
if (state == PROCESS_RUNNING) if (state == PROCESS_RUNNING)
ft_putstr("running "); ft_asprintf(&statestr, "running");
else if (state == PROCESS_SUSPENDED) else if (state == PROCESS_SUSPENDED)
ft_putstr("suspended"); ft_asprintf(&statestr, "suspended");
else if (state == PROCESS_CONTINUED) else if (state == PROCESS_CONTINUED)
{ {
ft_putstr("continued"); ft_asprintf(&statestr, "continued");
p->attrs &= ~PROCESS_STATE_MASK; p->attrs &= ~PROCESS_STATE_MASK;
p->attrs |= PROCESS_RUNNING; p->attrs |= PROCESS_RUNNING;
} }
else if (state == PROCESS_COMPLETED) else if (state == PROCESS_COMPLETED)
{ {
if (p->status == 0) if (WIFSIGNALED(p->status))
ft_putstr("done "); ft_asprintf(&statestr, strsignal(WTERMSIG(p->status)));
else if (p->status == 0)
ft_asprintf(&statestr, "done");
else else
ft_printf("exit %i ", p->status); ft_asprintf(&statestr, "%s %i", "exit", WEXITSTATUS(p->status));
} }
ft_putchar('\t'); ft_printf("%-*s\t", 12, statestr);
ft_strdel(&statestr);
} }
static void process_format_com_long(t_list **plist) static void process_format_com_long(t_list **plist)

View file

@ -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/17 21:16:25 by jhalford ### ########.fr */ /* Updated: 2017/03/17 21:18:44 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/12 17:23:59 by jhalford #+# #+# */ /* Created: 2016/12/12 17:23:59 by jhalford #+# #+# */
/* Updated: 2017/03/17 21:16:24 by jhalford ### ########.fr */ /* Updated: 2017/03/17 21:18:46 by jhalford ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */