From 18f847e4464d1a4975b846079dd96262ad5a67f7 Mon Sep 17 00:00:00 2001 From: gwojda Date: Fri, 24 Mar 2017 17:25:53 +0100 Subject: [PATCH] Your fight is over --- 42sh/src/exec/exec_func.c | 3 +-- 42sh/src/exec/process_redirect.c | 3 +-- 42sh/src/exec/redir_copy.c | 3 +-- 42sh/src/exec/redirect_great.c | 3 +-- 42sh/src/job_control/job_format_head.c | 5 ++--- 42sh/src/job_control/job_hup_all.c | 6 ++---- 42sh/src/job_control/put_job_in_foreground.c | 6 +----- 42sh/src/job_control/sigint_handler.c | 5 ++--- 42sh/src/job_control/sigttin_handler.c | 5 ++--- 42sh/src/job_control/sigttou_handler.c | 3 +-- 42sh/src/lexer/lexer_destroy.c | 2 +- 42sh/src/lexer/token_print.c | 6 ++---- 42sh/src/main/main.c | 3 +-- 42sh/src/parser/add_redir.c | 6 ++---- 42sh/src/parser/aggregate_sym.c | 15 +-------------- 42sh/src/parser/eval_sym.c | 6 +----- 42sh/src/parser/read_stack.c | 5 +---- 17 files changed, 23 insertions(+), 62 deletions(-) diff --git a/42sh/src/exec/exec_func.c b/42sh/src/exec/exec_func.c index e1c4e621..a7645931 100644 --- a/42sh/src/exec/exec_func.c +++ b/42sh/src/exec/exec_func.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/23 16:25:23 by ariard #+# #+# */ -/* Updated: 2017/03/24 16:36:39 by ariard ### ########.fr */ +/* Updated: 2017/03/24 17:22:12 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -45,7 +45,6 @@ int exec_func(t_btree **ast) t_btree *func_ast; t_list *old_func; - DG(); func_ast = btree_map(*ast, &node_copy); if ((old_func = is_already_func(&func_ast))) { diff --git a/42sh/src/exec/process_redirect.c b/42sh/src/exec/process_redirect.c index 43280efe..c9f63252 100644 --- a/42sh/src/exec/process_redirect.c +++ b/42sh/src/exec/process_redirect.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/29 16:04:18 by jhalford #+# #+# */ -/* Updated: 2017/03/24 15:51:24 by ariard ### ########.fr */ +/* Updated: 2017/03/24 17:22:18 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -36,7 +36,6 @@ int process_redirect(t_process *p) fd_replace(p->fdout, STDOUT); while (redirs) { - DG(); redir = redirs->content; if (redir->n > 9) return (bad_fd(redir->n)); diff --git a/42sh/src/exec/redir_copy.c b/42sh/src/exec/redir_copy.c index 03f17ce0..c5dff257 100644 --- a/42sh/src/exec/redir_copy.c +++ b/42sh/src/exec/redir_copy.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/08 00:02:58 by ariard #+# #+# */ -/* Updated: 2017/03/24 15:54:27 by ariard ### ########.fr */ +/* Updated: 2017/03/24 17:22:23 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -19,7 +19,6 @@ void *redir_copy(void *data) if (!data) return (NULL); - DG(); old = data; new = (t_redir *)ft_memalloc(sizeof(t_redir)); new->type = old->type; diff --git a/42sh/src/exec/redirect_great.c b/42sh/src/exec/redirect_great.c index a461858a..574c484f 100644 --- a/42sh/src/exec/redirect_great.c +++ b/42sh/src/exec/redirect_great.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/06 22:03:53 by jhalford #+# #+# */ -/* Updated: 2017/03/24 15:59:36 by ariard ### ########.fr */ +/* Updated: 2017/03/24 17:22:28 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -21,7 +21,6 @@ int redirect_great(t_redir *redir) if ((fdold = open(redir->word, O_WRONLY | O_CREAT | O_TRUNC, 0644)) < 0) exit(1); - DG("%d %d", fdold, fdnew); dup2(fdold, fdnew); return (0); } diff --git a/42sh/src/job_control/job_format_head.c b/42sh/src/job_control/job_format_head.c index 450fcdeb..bf0f0cac 100644 --- a/42sh/src/job_control/job_format_head.c +++ b/42sh/src/job_control/job_format_head.c @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* job_format_head.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: jhalford +#+ +:+ +#+ */ +/* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/09 13:10:38 by jhalford #+# #+# */ -/* Updated: 2017/03/21 14:55:16 by jhalford ### ########.fr */ +/* Updated: 2017/03/24 17:22:36 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -20,6 +20,5 @@ void job_format_head(t_job *j) job_getrank(&rank); crank = j->id == rank[0] ? '+' : ' '; crank = j->id == rank[1] ? '-' : crank; - DG("raks [%i:%i]", rank[0], rank[1]); ft_printf("{mag}[%i]%c {eoc}", j->id, crank); } diff --git a/42sh/src/job_control/job_hup_all.c b/42sh/src/job_control/job_hup_all.c index 0933048b..8a3df3b1 100644 --- a/42sh/src/job_control/job_hup_all.c +++ b/42sh/src/job_control/job_hup_all.c @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* job_hup_all.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: jhalford +#+ +:+ +#+ */ +/* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/20 11:37:40 by jhalford #+# #+# */ -/* Updated: 2017/03/24 15:40:55 by jhalford ### ########.fr */ +/* Updated: 2017/03/24 17:22:42 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -25,11 +25,9 @@ void job_hup_all(void) while (jlist) { job = jlist->content; - DG("gonna SIGHUP %i", job->pgid); builtin_jobs(NULL, NULL, NULL); if (job->pgid != 1) kill(-job->pgid, SIGHUP); - DG("after SIGHUP %i", job->pgid); jlist = jlist->next; } } diff --git a/42sh/src/job_control/put_job_in_foreground.c b/42sh/src/job_control/put_job_in_foreground.c index 7714628a..22f79779 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/03/22 16:32:56 by jhalford ### ########.fr */ +/* Updated: 2017/03/24 17:24:24 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -20,11 +20,7 @@ int put_job_in_foreground(t_job *j, int cont) if (SH_IS_INTERACTIVE(data_singleton()->opts)) tcsetpgrp(STDIN, j->pgid); if (cont) - { tcsetattr(STDIN, TCSADRAIN, &j->tmodes); - if (kill(-j->pgid, SIGCONT) < 0) - DG("kill(SIGCONT) failed"); - } job_wait(j->id); if (SH_IS_INTERACTIVE(data_singleton()->opts)) { diff --git a/42sh/src/job_control/sigint_handler.c b/42sh/src/job_control/sigint_handler.c index 2d1ca5b6..cdb16537 100644 --- a/42sh/src/job_control/sigint_handler.c +++ b/42sh/src/job_control/sigint_handler.c @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* sigint_handler.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: jhalford +#+ +:+ +#+ */ +/* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/10 15:14:47 by jhalford #+# #+# */ -/* Updated: 2017/03/22 18:17:42 by jhalford ### ########.fr */ +/* Updated: 2017/03/24 17:24:18 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,5 +16,4 @@ void sigint_handler(int signo) { (void)signo; set_exitstatus(1, 1); - DG("pid:%i got SIGINT", getpid()); } diff --git a/42sh/src/job_control/sigttin_handler.c b/42sh/src/job_control/sigttin_handler.c index 2f5f9402..21c01466 100644 --- a/42sh/src/job_control/sigttin_handler.c +++ b/42sh/src/job_control/sigttin_handler.c @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* sigttin_handler.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: jhalford +#+ +:+ +#+ */ +/* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/10 15:14:53 by jhalford #+# #+# */ -/* Updated: 2017/01/22 17:22:10 by ariard ### ########.fr */ +/* Updated: 2017/03/24 17:24:13 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,5 +15,4 @@ void sigttin_handler(int signo) { (void)signo; - DG("got SIGTTIN, pid=%i, pgid=%i", getpid(), getpgrp()); } diff --git a/42sh/src/job_control/sigttou_handler.c b/42sh/src/job_control/sigttou_handler.c index f411d744..501e4b96 100644 --- a/42sh/src/job_control/sigttou_handler.c +++ b/42sh/src/job_control/sigttou_handler.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/10 15:14:53 by jhalford #+# #+# */ -/* Updated: 2017/03/20 10:30:55 by jhalford ### ########.fr */ +/* Updated: 2017/03/24 17:23:18 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,5 +15,4 @@ void sigttou_handler(int signo) { (void)signo; - DG("got SIGTTOU, pid=%i, pgid=%i", getpid(), getpgid(getpid())); } diff --git a/42sh/src/lexer/lexer_destroy.c b/42sh/src/lexer/lexer_destroy.c index d7684a15..feb14ed2 100644 --- a/42sh/src/lexer/lexer_destroy.c +++ b/42sh/src/lexer/lexer_destroy.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/16 20:25:08 by ariard #+# #+# */ -/* Updated: 2017/03/24 17:07:56 by gwojda ### ########.fr */ +/* Updated: 2017/03/24 17:15:18 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/lexer/token_print.c b/42sh/src/lexer/token_print.c index 2f0df7e5..6579d827 100644 --- a/42sh/src/lexer/token_print.c +++ b/42sh/src/lexer/token_print.c @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* token_print.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: jhalford +#+ +:+ +#+ */ +/* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/28 14:39:01 by jhalford #+# #+# */ -/* Updated: 2017/03/22 17:13:31 by jhalford ### ########.fr */ +/* Updated: 2017/03/24 17:24:09 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -20,8 +20,6 @@ void token_print(t_list *lst) { if (lst->content) token = lst->content; - if (token->type) - DG("token : %s data [%s]", read_state(token->type), token->data); lst = lst->next; } } diff --git a/42sh/src/main/main.c b/42sh/src/main/main.c index 396dc632..8f84dbe6 100644 --- a/42sh/src/main/main.c +++ b/42sh/src/main/main.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/20 14:45:40 by gwojda #+# #+# */ -/* Updated: 2017/03/24 17:11:37 by wescande ### ########.fr */ +/* Updated: 2017/03/24 17:24:04 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -66,7 +66,6 @@ int main(int ac, char **av, char **env) t_btree *ast; g_argv = av; - DG("----------------"); if (shell_init(ac, av, env) != 0) return (1); token = NULL; diff --git a/42sh/src/parser/add_redir.c b/42sh/src/parser/add_redir.c index a5b2ee0c..ec189830 100644 --- a/42sh/src/parser/add_redir.c +++ b/42sh/src/parser/add_redir.c @@ -1,12 +1,12 @@ /* ************************************************************************** */ /* */ /* ::: :::::::: */ -/* add_file.c :+: :+: :+: */ +/* add_redir.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/17 16:39:05 by ariard #+# #+# */ -/* Updated: 2017/03/24 15:55:55 by ariard ### ########.fr */ +/* Updated: 2017/03/24 17:24:01 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -71,7 +71,6 @@ int add_redir_word(t_btree **ast, t_list **lst) token = (*lst)->content; node = (*ast)->item; - DG("node type is %s", read_state(node->type)); if (node->data.cmd.redir) { redir = (ft_lstlast(node->data.cmd.redir))->content; @@ -112,7 +111,6 @@ int add_redir_type(t_btree **ast, t_list **lst) gen_node(ast); token = (*lst)->content; node = (*ast)->item; - DG("node type is %s", read_state(node->type)); if (!(node->type == TK_IO_NUMBER)) { redir_init(token->type, &redir); diff --git a/42sh/src/parser/aggregate_sym.c b/42sh/src/parser/aggregate_sym.c index 640c04be..e5e9c7bb 100644 --- a/42sh/src/parser/aggregate_sym.c +++ b/42sh/src/parser/aggregate_sym.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/11 15:58:38 by ariard #+# #+# */ -/* Updated: 2017/03/23 16:48:38 by ariard ### ########.fr */ +/* Updated: 2017/03/24 17:23:26 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -397,16 +397,3 @@ int aggregate_sym(t_list **stack, t_sym *new_sym, t_parstate *state) } return (0); } - -/* -** DG("aggregate head %s && sym %s", -** read_state(*head), read_state(*new_sym)); -*/ - -/* -** DG("MATCH : %s", read_state(g_aggrematch[i].new_sym)); -*/ - -/* -** DG("stack after pop: %s", read_state(*head)); -*/ diff --git a/42sh/src/parser/eval_sym.c b/42sh/src/parser/eval_sym.c index e6e8fce3..e8fbda17 100644 --- a/42sh/src/parser/eval_sym.c +++ b/42sh/src/parser/eval_sym.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/11 16:11:21 by ariard #+# #+# */ -/* Updated: 2017/03/23 16:48:22 by ariard ### ########.fr */ +/* Updated: 2017/03/24 17:23:52 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -1295,7 +1295,3 @@ int eval_sym(t_list **stack, t_sym new_sym) } return (1); } - -/* -** DG("eval head %s && sym %s", read_state(*head), read_state(new_sym)); -*/ diff --git a/42sh/src/parser/read_stack.c b/42sh/src/parser/read_stack.c index c6ad591b..43443a85 100644 --- a/42sh/src/parser/read_stack.c +++ b/42sh/src/parser/read_stack.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/09 15:32:10 by ariard #+# #+# */ -/* Updated: 2017/03/20 14:59:23 by gwojda ### ########.fr */ +/* Updated: 2017/03/24 17:25:03 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -221,7 +221,6 @@ char *read_state(t_sym current) int ft_read_stack(t_sym *stack) { - DG("read stack :"); while (*stack) DG("%s", read_state(*stack--)); return (0); @@ -236,7 +235,5 @@ int ft_show_heredoc_data(t_astnode *node) redir = (node->data.cmd.redir)->content; if (redir->type != TK_DLESS) return (1); - DG("heredoc_data=[%s] @ %p", redir->heredoc_data, redir->heredoc_data); - DG("redir @ %p", redir); return (0); }