diff --git a/42sh/libft/includes/libft.h b/42sh/libft/includes/libft.h index 56cdf59b..986cda46 100644 --- a/42sh/libft/includes/libft.h +++ b/42sh/libft/includes/libft.h @@ -6,7 +6,7 @@ /* 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 */ /* */ /* ************************************************************************** */ diff --git a/42sh/libft/src/ft_printf/ft_printf.c b/42sh/libft/src/ft_printf/ft_printf.c index fb813acd..f392b79e 100644 --- a/42sh/libft/src/ft_printf/ft_printf.c +++ b/42sh/libft/src/ft_printf/ft_printf.c @@ -6,7 +6,7 @@ /* 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 */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/exec/mark_process_status.c b/42sh/src/exec/mark_process_status.c index 3c2ef390..dbde6d7d 100644 --- a/42sh/src/exec/mark_process_status.c +++ b/42sh/src/exec/mark_process_status.c @@ -6,7 +6,7 @@ /* 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_COMPLETED; - if (WIFSIGNALED(status) && DEBUG_MODE) - ft_printf("{mag}%d: Terminated by signal %d.\n{eoc}", - (int)pid, WTERMSIG(status)); + if (WIFSIGNALED(status)) + psignal(WTERMSIG(status), NULL); + /* ft_printf("{mag}%d: Terminated by signal %d.\n{eoc}", */ + /* (int)pid, WTERMSIG(status)); */ } return (0); } diff --git a/42sh/src/job-control/process_format.c b/42sh/src/job-control/process_format.c index facaad6f..783fea8c 100644 --- a/42sh/src/job-control/process_format.c +++ b/42sh/src/job-control/process_format.c @@ -6,7 +6,7 @@ /* 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 */ /* */ /* ************************************************************************** */ @@ -34,27 +34,32 @@ static int redirection_print(t_redir *redir) static void process_format_state(t_process *p) { - int state; + int state; + char *statestr; state = p->attrs & PROCESS_STATE_MASK; + statestr = NULL; if (state == PROCESS_RUNNING) - ft_putstr("running "); + ft_asprintf(&statestr, "running"); else if (state == PROCESS_SUSPENDED) - ft_putstr("suspended"); + ft_asprintf(&statestr, "suspended"); else if (state == PROCESS_CONTINUED) { - ft_putstr("continued"); + ft_asprintf(&statestr, "continued"); p->attrs &= ~PROCESS_STATE_MASK; p->attrs |= PROCESS_RUNNING; } else if (state == PROCESS_COMPLETED) { - if (p->status == 0) - ft_putstr("done "); + if (WIFSIGNALED(p->status)) + ft_asprintf(&statestr, strsignal(WTERMSIG(p->status))); + else if (p->status == 0) + ft_asprintf(&statestr, "done"); 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) diff --git a/42sh/src/main/data_init.c b/42sh/src/main/data_init.c index 71d87f6b..7c901196 100644 --- a/42sh/src/main/data_init.c +++ b/42sh/src/main/data_init.c @@ -6,7 +6,7 @@ /* 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 */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/main/shell_init.c b/42sh/src/main/shell_init.c index 28ee9e8d..a8441c2e 100644 --- a/42sh/src/main/shell_init.c +++ b/42sh/src/main/shell_init.c @@ -6,7 +6,7 @@ /* 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 */ /* */ /* ************************************************************************** */