diff --git a/42sh/src/exec/launch_process.c b/42sh/src/exec/launch_process.c index fb3a463a..116af8ed 100644 --- a/42sh/src/exec/launch_process.c +++ b/42sh/src/exec/launch_process.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/13 14:20:45 by jhalford #+# #+# */ -/* Updated: 2017/01/11 18:01:10 by jhalford ### ########.fr */ +/* Updated: 2017/01/31 13:47:57 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -30,7 +30,6 @@ int launch_process(t_process *p) { p->attributes &= ~PROCESS_STATE_MASK; p->attributes |= PROCESS_RUNNING; - DG("process is to be forked, %i->[]->%i, attr=%b", p->fdin, p->fdout, p->attributes); if (p->attributes & (PROCESS_BINARY | PROCESS_SCRIPT) && access(p->path, X_OK) == -1) { diff --git a/42sh/src/glob/glob_print.c b/42sh/src/glob/glob_print.c index 46fcdd8d..e25ac25d 100644 --- a/42sh/src/glob/glob_print.c +++ b/42sh/src/glob/glob_print.c @@ -6,7 +6,7 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/05 16:09:40 by wescande #+# #+# */ -/* Updated: 2017/01/27 21:57:24 by wescande ### ########.fr */ +/* Updated: 2017/01/31 13:43:56 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/job-control/job_is_completed.c b/42sh/src/job-control/job_is_completed.c index 1895291c..17970b3d 100644 --- a/42sh/src/job-control/job_is_completed.c +++ b/42sh/src/job-control/job_is_completed.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/13 15:10:20 by jhalford #+# #+# */ -/* Updated: 2017/01/12 15:15:21 by jhalford ### ########.fr */ +/* Updated: 2017/01/31 13:50:40 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -25,12 +25,8 @@ int job_is_completed(int id) while (lst) { p = lst->content; - DG("checking pid=%i", p->pid); if (!(p->attributes & PROCESS_COMPLETED)) - { - DG("process %i is not completed", p->pid); return (0); - } lst = lst->next; } return (1); diff --git a/42sh/src/job-control/job_remove.c b/42sh/src/job-control/job_remove.c index afcfa110..6c779b89 100644 --- a/42sh/src/job-control/job_remove.c +++ b/42sh/src/job-control/job_remove.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/15 12:51:08 by jhalford #+# #+# */ -/* Updated: 2017/01/12 15:16:05 by jhalford ### ########.fr */ +/* Updated: 2017/01/31 13:44:26 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -19,11 +19,8 @@ void job_remove(int id) jobc = &data_singleton()->jobc; if (job_is_completed(id)) { - DG("job_remove"); if (id < data_singleton()->jobc.current_id) data_singleton()->jobc.current_id = id; ft_lst_delif(&jobc->first_job, &id, job_cmp_id, job_free); } - else - DG("job_remove failed (not completed)"); } diff --git a/42sh/src/job-control/job_wait.c b/42sh/src/job-control/job_wait.c index 89268b18..1c49950a 100644 --- a/42sh/src/job-control/job_wait.c +++ b/42sh/src/job-control/job_wait.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/15 11:49:05 by jhalford #+# #+# */ -/* Updated: 2017/01/12 15:14:38 by jhalford ### ########.fr */ +/* Updated: 2017/01/31 13:44:17 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -17,19 +17,14 @@ 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_completed(id) && !job_is_stopped(id)) { - DG("waitpid now"); pid = waitpid(WAIT_ANY, &status, WUNTRACED); - DG("waitpid done"); } return (0); } diff --git a/42sh/src/job-control/process_mark_status.c b/42sh/src/job-control/process_mark_status.c index c7bfe4e8..2ae9375a 100644 --- a/42sh/src/job-control/process_mark_status.c +++ b/42sh/src/job-control/process_mark_status.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/12 12:41:11 by jhalford #+# #+# */ -/* Updated: 2017/01/12 15:14:28 by jhalford ### ########.fr */ +/* Updated: 2017/01/31 13:44:49 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/job-control/put_job_in_foreground.c b/42sh/src/job-control/put_job_in_foreground.c index 3b0f05d6..6027c234 100644 --- a/42sh/src/job-control/put_job_in_foreground.c +++ b/42sh/src/job-control/put_job_in_foreground.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/13 14:58:36 by jhalford #+# #+# */ -/* Updated: 2017/01/12 13:16:48 by jhalford ### ########.fr */ +/* Updated: 2017/01/31 13:47:41 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -17,10 +17,8 @@ int put_job_in_foreground(t_job *job, int cont) t_jobc *jobc; jobc = &data_singleton()->jobc; - /* Send the job a continue signal, if necessary. */ if (cont) { - /* Put the job into the foreground. */ signal(SIGTTOU, SIG_IGN); if (tcsetpgrp(STDIN, job->pgid) == -1) DG("couldn't put process in control. errno=%i, pgid=%i", errno, job->pgid); @@ -29,17 +27,11 @@ int put_job_in_foreground(t_job *job, int cont) if (kill(-job->pgid, SIGCONT) < 0) perror("kill (SIGCONT)"); } - /* Wait for it to report. */ - DG("gonna wait for job id=%i", job->id); job_wait(job->id); job_remove(job->id); - - /* Put the shell back in the foreground. */ signal(SIGTTOU, SIG_IGN); tcsetpgrp(STDIN, jobc->shell_pgid); signal(SIGTTOU, sigttou_handler); - - /* Restore the shell’s terminal modes. */ tcgetattr(STDIN, &job->tmodes); tcsetattr(STDIN, TCSADRAIN, &jobc->shell_tmodes); return (0); diff --git a/42sh/src/lexer/ft_tokenize.c b/42sh/src/lexer/ft_tokenize.c index de620b65..b94670d7 100644 --- a/42sh/src/lexer/ft_tokenize.c +++ b/42sh/src/lexer/ft_tokenize.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/10 13:37:11 by jhalford #+# #+# */ -/* Updated: 2017/01/27 15:43:46 by wescande ### ########.fr */ +/* Updated: 2017/01/31 13:42:01 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/main/main.c b/42sh/src/main/main.c index 55c960f3..509212c8 100644 --- a/42sh/src/main/main.c +++ b/42sh/src/main/main.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/06 18:40:58 by jhalford #+# #+# */ -/* Updated: 2017/01/30 13:09:12 by wescande ### ########.fr */ +/* Updated: 2017/01/31 13:50:28 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -34,8 +34,6 @@ int shell_single_command(char *command) if (ft_parse(&ast, &token)) return (1); btree_print(STDBUG, ast, &ft_putast); - /* /1* ft_dprintf(STDBUG, "\n--- INFIX BREAKDOWN ---\n"); *1/ */ - /* /1* btree_apply_infix(ast, &ft_putast2); *1/ */ if (ft_exec(&ast)) return (1); return (0);