clean: norm

This commit is contained in:
Camille Chauvet 2023-03-30 13:12:56 +02:00
parent 1c43d89fa1
commit 7e77c4fe48

12
main.c
View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */ /* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/16 15:16:14 by cchauvet #+# #+# */ /* Created: 2023/02/16 15:16:14 by cchauvet #+# #+# */
/* Updated: 2023/03/30 12:41:52 by cchauvet ### ########.fr */ /* Updated: 2023/03/30 13:12:41 by cchauvet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -43,17 +43,17 @@ static char *ft_get_user_input(void)
static void ft_cmds_waiter(t_data *data) static void ft_cmds_waiter(t_data *data)
{ {
t_list *current; t_list *current;
t_cmd *content; t_cmd *cmd;
int exit_status; int exit_status;
current = *data->cmds; current = *data->cmds;
while (current != NULL) while (current != NULL)
{ {
content = current->content; cmd = current->content;
if (content->executable != NULL && content->own_cmd == 0 if (cmd->executable != NULL && cmd->own_cmd == 0
&& content->pid != -1 && content->fd_in[0] != -2 && content->fd_out[0] != -2) && cmd->pid != -1 && cmd->fd_in[0] != -2 && cmd->fd_out[0] != -2)
{ {
waitpid(content->pid, &exit_status, 0); waitpid(cmd->pid, &exit_status, 0);
if (WIFSIGNALED(exit_status)) if (WIFSIGNALED(exit_status))
{ {
if (WTERMSIG(exit_status) == SIGKILL) if (WTERMSIG(exit_status) == SIGKILL)