j'avais cassé Ctrl-Z en mergeant, c'est fix
This commit is contained in:
parent
7adffb7a60
commit
757976474e
16 changed files with 28 additions and 55 deletions
1
42sh/.gitignore
vendored
1
42sh/.gitignore
vendored
|
|
@ -2,4 +2,5 @@ minishell
|
|||
21sh
|
||||
42sh
|
||||
out
|
||||
debug
|
||||
*.dSYM
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: sbenning <sbenning@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/08 18:02:25 by sbenning #+# #+# */
|
||||
/* Updated: 2017/01/10 17:01:47 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/01/10 17:59:30 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/10 13:07:44 by jhalford #+# #+# */
|
||||
/* Updated: 2017/01/10 13:12:41 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/01/10 17:59:41 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/13 14:20:45 by jhalford #+# #+# */
|
||||
/* Updated: 2017/01/10 13:16:45 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/01/10 17:47:21 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/15 11:49:05 by jhalford #+# #+# */
|
||||
/* Updated: 2017/01/08 16:00:23 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/01/10 17:58:27 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -17,9 +17,12 @@ int job_wait(int id)
|
|||
pid_t pid;
|
||||
int status;
|
||||
|
||||
DG("job wait");
|
||||
if (job_is_stopped(id) || job_is_completed(id))
|
||||
return (0);
|
||||
DG("waitpid now");
|
||||
pid = waitpid(WAIT_ANY, &status, WUNTRACED);
|
||||
DG("waitpid done");
|
||||
while (!process_mark_status(pid, status)
|
||||
&& !job_is_stopped(id)
|
||||
&& !job_is_completed(id))
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/13 14:58:36 by jhalford #+# #+# */
|
||||
/* Updated: 2017/01/10 17:07:29 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/01/10 17:47:41 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/10 17:37:56 by jhalford #+# #+# */
|
||||
/* Updated: 2017/01/10 12:33:18 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/01/10 17:59:28 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -21,6 +21,6 @@ void sigchld_handler(int signo)
|
|||
/* DG("got SIGCHLD"); */
|
||||
/* if (do_job_notification()) */
|
||||
/* ft_putstr(SHELL_PROMPT); */
|
||||
if (data_singleton()->mode != MODE_EXEC)
|
||||
job_update_status();
|
||||
/* if (data_singleton()->mode != MODE_EXEC) */
|
||||
/* job_update_status(); */
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/10 15:14:47 by jhalford #+# #+# */
|
||||
/* Updated: 2017/01/09 16:16:20 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/01/10 17:24:06 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -15,5 +15,5 @@
|
|||
void sigint_handler(int signo)
|
||||
{
|
||||
(void)signo;
|
||||
DG("got SIGINT");
|
||||
DG("got SIGINT in process %i", getpid());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/10 15:14:53 by jhalford #+# #+# */
|
||||
/* Updated: 2017/01/10 16:49:33 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/01/10 18:02:54 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -19,5 +19,4 @@ void sigtstp_handler(int signo)
|
|||
(void)signo;
|
||||
jobc = &data_singleton()->jobc;
|
||||
DG("got SIGTSTP in process %i", getpid());
|
||||
kill(jobc->shell_pgid, SIGCONT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: sbenning <sbenning@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/08 17:28:50 by sbenning #+# #+# */
|
||||
/* Updated: 2016/12/09 16:51:33 by sbenning ### ########.fr */
|
||||
/* Updated: 2017/01/10 17:20:41 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: sbenning <sbenning@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/08 16:36:43 by sbenning #+# #+# */
|
||||
/* Updated: 2016/12/09 16:46:01 by sbenning ### ########.fr */
|
||||
/* Updated: 2017/01/10 18:03:01 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: sbenning <sbenning@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/08 16:50:26 by sbenning #+# #+# */
|
||||
/* Updated: 2017/01/10 11:54:47 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/01/10 18:04:56 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -36,7 +36,7 @@ int curs_term_setup(void)
|
|||
if (tcgetattr(0, single) < 0)
|
||||
return (-1);
|
||||
term = *single;
|
||||
term.c_lflag &= ~(ECHO | ICANON);
|
||||
term.c_lflag &= ~(ECHO | ICANON | ISIG);
|
||||
term.c_cc[VTIME] = 0;
|
||||
term.c_cc[VMIN] = 1;
|
||||
if (tcsetattr(0, TCSADRAIN, &term) < 0)
|
||||
|
|
@ -51,8 +51,11 @@ int curs_term_setup(void)
|
|||
int curs_term_cleanup(void)
|
||||
{
|
||||
struct termios *single;
|
||||
struct termios term;
|
||||
|
||||
single = curs_term();
|
||||
term = *single;
|
||||
term.c_lflag |= ECHO | ICANON | ISIG;
|
||||
if (tcsetattr(0, TCSADRAIN, single) < 0)
|
||||
return (-1);
|
||||
return (0);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: sbenning <sbenning@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/09 13:34:29 by sbenning #+# #+# */
|
||||
/* Updated: 2016/12/09 13:50:20 by sbenning ### ########.fr */
|
||||
/* Updated: 2017/01/10 17:46:00 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,33 +0,0 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* rl_set_termios.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/10 17:00:16 by jhalford #+# #+# */
|
||||
/* Updated: 2017/01/10 17:02:50 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "minishell.h"
|
||||
|
||||
int rl_set_termios(int input_mode)
|
||||
{
|
||||
struct termios term;
|
||||
|
||||
if (tcgetattr(0, &term) == -1)
|
||||
{
|
||||
DG("tcgetattr failed, errno=%i", errno);
|
||||
return (-1);
|
||||
}
|
||||
if (input_mode)
|
||||
term.c_lflag &= ~(ICANON) & ~(ISIG) & ~(ECHO);
|
||||
else
|
||||
term.c_lflag |= ICANON | ISIG | ECHO;
|
||||
term.c_cc[VMIN] = 1;
|
||||
term.c_cc[VTIME] = 0;
|
||||
if (tcsetattr(0, TCSADRAIN, &term) == -1)
|
||||
return (-1);
|
||||
return (0);
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: sbenning <sbenning@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/08 18:07:47 by sbenning #+# #+# */
|
||||
/* Updated: 2017/01/10 17:06:13 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/01/10 18:02:59 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
int rl_setup(t_line *line)
|
||||
{
|
||||
rl_set_termios(1);
|
||||
do_job_notification();
|
||||
data_singleton()->mode = MODE_INPUT;
|
||||
ft_bzero(line, sizeof(t_line));
|
||||
if (curs_setup(&line->curs) < 0)
|
||||
return (-1);
|
||||
|
|
@ -26,7 +26,7 @@ int rl_setup(t_line *line)
|
|||
|
||||
int rl_cleanup(t_line *line)
|
||||
{
|
||||
rl_set_termios(0);
|
||||
data_singleton()->mode = MODE_EXEC;
|
||||
if (curs_cleanup(&line->curs) < 0)
|
||||
return (-1);
|
||||
if (rl_merge_line(line) < 0)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/12/12 17:23:59 by jhalford #+# #+# */
|
||||
/* Updated: 2017/01/10 17:05:44 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/01/10 17:10:36 by jhalford ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ void shell_init(void)
|
|||
kill(-*shell_pgid, SIGTTIN);
|
||||
signal(SIGINT, sigint_handler);
|
||||
signal(SIGQUIT, SIG_IGN);
|
||||
signal(SIGTSTP, SIG_IGN);
|
||||
signal(SIGTSTP, sigtstp_handler);
|
||||
signal(SIGTTIN, sigttin_handler);
|
||||
signal(SIGTTOU, sigttou_handler);
|
||||
signal(SIGCHLD, sigchld_handler);
|
||||
|
|
|
|||
Loading…
Reference in a new issue