diff --git a/42sh/script.sh b/42sh/script.sh index 25c8c48c..1a566882 100755 --- a/42sh/script.sh +++ b/42sh/script.sh @@ -1,3 +1,4 @@ +#!/bin/sh while [ 1 ]; do sleep 1 done diff --git a/42sh/src/exec/ft_cmd.c b/42sh/src/exec/ft_cmd.c index eaf76ba6..b16bd187 100644 --- a/42sh/src/exec/ft_cmd.c +++ b/42sh/src/exec/ft_cmd.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/27 21:13:18 by jhalford #+# #+# */ -/* Updated: 2016/11/29 20:22:38 by jhalford ### ########.fr */ +/* Updated: 2016/12/01 13:47:33 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -57,9 +57,11 @@ int ft_cmd_exec(char *execpath, char **argv, t_data *data) g_pid = pid; if (data->fdout == STDOUT) { + ft_printf("[waiting for PID = %i]\n", pid); waitpid(pid, &status, 0); builtin_setenv((char*[3]){"?", ft_itoa(status)}, data); } + g_pid = 0; } return (0); } diff --git a/42sh/src/line-editing/ft_interactive_sh.c b/42sh/src/line-editing/ft_interactive_sh.c index 29f1a874..5db1826c 100644 --- a/42sh/src/line-editing/ft_interactive_sh.c +++ b/42sh/src/line-editing/ft_interactive_sh.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/01 12:14:12 by jhalford #+# #+# */ -/* Updated: 2016/12/01 12:29:32 by jhalford ### ########.fr */ +/* Updated: 2016/12/01 12:42:35 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/line-editing/ft_set_termios.c b/42sh/src/line-editing/ft_set_termios.c index c59eefb8..44ae788a 100644 --- a/42sh/src/line-editing/ft_set_termios.c +++ b/42sh/src/line-editing/ft_set_termios.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/01 12:14:09 by jhalford #+# #+# */ -/* Updated: 2016/12/01 12:29:41 by jhalford ### ########.fr */ +/* Updated: 2016/12/01 14:26:56 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -24,11 +24,10 @@ int ft_set_termios(t_data *data, int input_mode) return (-1); if (tcgetattr(0, &term) == -1) return (-1); - term.c_lflag &= ~(ICANON); // Met le terminal en mode canonique. if (input_mode) - term.c_lflag &= ~(ISIG) & ~(ECHO); + term.c_lflag &= ~(ICANON) & ~(ISIG) & ~(ECHO); else - term.c_lflag |= ISIG | ECHO; + term.c_lflag |= ICANON | ECHO; term.c_cc[VMIN] = 1; term.c_cc[VTIME] = 0; if (tcsetattr(0, TCSADRAIN, &term) == -1) diff --git a/42sh/src/main/main.c b/42sh/src/main/main.c index 58ee6142..89f460d4 100644 --- a/42sh/src/main/main.c +++ b/42sh/src/main/main.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/27 21:13:34 by jhalford #+# #+# */ -/* Updated: 2016/12/01 12:28:47 by jhalford ### ########.fr */ +/* Updated: 2016/12/01 13:47:36 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/main/sig_handler.c b/42sh/src/main/sig_handler.c index 49efa24d..33efbb46 100644 --- a/42sh/src/main/sig_handler.c +++ b/42sh/src/main/sig_handler.c @@ -1,12 +1,27 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* sig_handler.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: jhalford +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2016/12/01 12:43:22 by jhalford #+# #+# */ +/* Updated: 2016/12/01 14:27:00 by jhalford ### ########.fr */ +/* */ +/* ************************************************************************** */ + #include "minishell.h" pid_t g_pid; void sig_handler(int signo) { - if (signo == SIGINT) - { - exit(1); - if (g_pid) - kill(g_pid, SIGINT); - } + (void)signo; + /* if (signo == SIGINT) */ + /* { */ + /* ft_printf("got SIGINT, g_pid = %i\n", g_pid); */ + /* if (g_pid) */ + /* kill(g_pid, SIGINT); */ + /* if (kill(g_pid, 0) == 0) */ + /* ft_putendl(""); */ + /* } */ }