From b9e5321b5b8a47f8b4a6cb733c176e37e15aaa10 Mon Sep 17 00:00:00 2001 From: gwojda Date: Mon, 20 Mar 2017 18:18:34 +0100 Subject: [PATCH] bye bye DG --- 42sh/src/builtin/is_builtin.c | 5 +---- 42sh/src/completion/c_match.c | 3 +-- 42sh/src/exec/plaunch_case.c | 3 +-- 42sh/src/exec/plaunch_function.c | 3 +-- 42sh/src/exec/redirect_dgreat.c | 7 ++----- 42sh/src/exec/redirect_great.c | 7 ++----- 42sh/src/exec/set_exitstatus.c | 7 ++----- 42sh/src/glob/command_getoutput.c | 3 +-- 42sh/src/history/list_toolz.c | 3 +-- 42sh/src/main/main.c | 4 +--- 42sh/src/main/shell_init.c | 7 +------ 42sh/src/parser/add_bang.c | 3 +-- 42sh/src/parser/add_condition.c | 5 ++--- 13 files changed, 17 insertions(+), 43 deletions(-) diff --git a/42sh/src/builtin/is_builtin.c b/42sh/src/builtin/is_builtin.c index 4f43e139..7c2a8769 100644 --- a/42sh/src/builtin/is_builtin.c +++ b/42sh/src/builtin/is_builtin.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/13 13:09:57 by jhalford #+# #+# */ -/* Updated: 2017/03/18 00:53:53 by wescande ### ########.fr */ +/* Updated: 2017/03/20 18:14:20 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -41,10 +41,7 @@ t_execf *is_builtin(t_process *p) while (g_builtin[++i].name) { if (ft_strcmp(g_builtin[i].name, p->data.cmd.av[0]) == 0) - { - DG(); return (g_builtin[i].f); - } } return (NULL); } diff --git a/42sh/src/completion/c_match.c b/42sh/src/completion/c_match.c index 4df444b5..03b81a0b 100644 --- a/42sh/src/completion/c_match.c +++ b/42sh/src/completion/c_match.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/10/15 13:27:14 by alao #+# #+# */ -/* Updated: 2017/03/20 14:41:04 by gwojda ### ########.fr */ +/* Updated: 2017/03/20 18:14:35 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -63,7 +63,6 @@ int c_matching(t_data *s, t_comp *c) char *current_word; current_word = c_current_words(c); - DG("current_word = %s", current_word); if (ft_strchr(c->rcmd, '/')) c_seek_abs_path(c, current_word); else if (ft_strchr(c->rcmd, '$')) diff --git a/42sh/src/exec/plaunch_case.c b/42sh/src/exec/plaunch_case.c index 753d221c..85806831 100644 --- a/42sh/src/exec/plaunch_case.c +++ b/42sh/src/exec/plaunch_case.c @@ -6,7 +6,7 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/07 19:02:23 by wescande #+# #+# */ -/* Updated: 2017/03/20 15:50:14 by gwojda ### ########.fr */ +/* Updated: 2017/03/20 18:15:17 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,7 +16,6 @@ int plaunch_case(t_process *p) { t_exec *exec; - DG("exec case"); exec = &data_singleton()->exec; exec->attrs &= ~EXEC_CASE_BRANCH; exec->case_pattern = token_to_argv(p->data.d_case.token, 1); diff --git a/42sh/src/exec/plaunch_function.c b/42sh/src/exec/plaunch_function.c index af12c567..87c7e34c 100644 --- a/42sh/src/exec/plaunch_function.c +++ b/42sh/src/exec/plaunch_function.c @@ -6,7 +6,7 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/08 03:23:59 by wescande #+# #+# */ -/* Updated: 2017/03/20 15:50:21 by gwojda ### ########.fr */ +/* Updated: 2017/03/20 18:15:21 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,7 +14,6 @@ int plaunch_function(t_process *p) { - DG("do function"); ft_exec(&p->data.function.content); return (ft_atoi(ft_getenv(data_singleton()->env, "?"))); } diff --git a/42sh/src/exec/redirect_dgreat.c b/42sh/src/exec/redirect_dgreat.c index 66fc6881..b1164f94 100644 --- a/42sh/src/exec/redirect_dgreat.c +++ b/42sh/src/exec/redirect_dgreat.c @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* redirect_dgreat.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: jhalford +#+ +:+ +#+ */ +/* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/06 22:07:37 by jhalford #+# #+# */ -/* Updated: 2017/03/05 18:10:36 by ariard ### ########.fr */ +/* Updated: 2017/03/20 18:15:39 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -20,10 +20,7 @@ int redirect_dgreat(t_redir *redir) fdnew = redir->n; if ((fdold = open(redir->word, O_WRONLY | O_CREAT | O_APPEND, 0644)) < 0) - { - DG("open errno=%i", errno); exit(1); - } dup2(fdold, fdnew); return (0); } diff --git a/42sh/src/exec/redirect_great.c b/42sh/src/exec/redirect_great.c index 24506564..49f59d8e 100644 --- a/42sh/src/exec/redirect_great.c +++ b/42sh/src/exec/redirect_great.c @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* redirect_great.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: jhalford +#+ +:+ +#+ */ +/* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/06 22:03:53 by jhalford #+# #+# */ -/* Updated: 2017/03/20 12:38:41 by jhalford ### ########.fr */ +/* Updated: 2017/03/20 18:15:43 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -20,10 +20,7 @@ int redirect_great(t_redir *redir) fdnew = redir->n; if ((fdold = open(redir->word, O_WRONLY | O_CREAT | O_TRUNC, 0644)) < 0) - { - DG("open errno=%i", errno); exit(1); - } dup2(fdold, fdnew); return (0); } diff --git a/42sh/src/exec/set_exitstatus.c b/42sh/src/exec/set_exitstatus.c index c3f2e8e3..08e20c5a 100644 --- a/42sh/src/exec/set_exitstatus.c +++ b/42sh/src/exec/set_exitstatus.c @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* set_exitstatus.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: jhalford +#+ +:+ +#+ */ +/* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/28 14:25:17 by jhalford #+# #+# */ -/* Updated: 2017/03/20 15:35:33 by jhalford ### ########.fr */ +/* Updated: 2017/03/20 18:15:50 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -26,10 +26,7 @@ void set_exitstatus(int status, int override) else if (WIFSIGNALED(status)) exitval = 128 + WTERMSIG(status); else - { - DG("%s: process was not exited nor signaled.", SHELL_NAME); return ; - } } astatus = ft_itoa(exitval); builtin_setenv("setenv", (char*[]){"setenv", "?", astatus, 0}, NULL); diff --git a/42sh/src/glob/command_getoutput.c b/42sh/src/glob/command_getoutput.c index f51688a7..471d0887 100644 --- a/42sh/src/glob/command_getoutput.c +++ b/42sh/src/glob/command_getoutput.c @@ -6,7 +6,7 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/14 19:44:25 by wescande #+# #+# */ -/* Updated: 2017/03/20 15:10:40 by wescande ### ########.fr */ +/* Updated: 2017/03/20 18:16:20 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -63,7 +63,6 @@ static void execute_command(char *const av[], char **env) data->opts &= ~SH_INTERACTIVE; data->opts &= ~SH_OPTS_JOBC; command = manage_command(av); - DG("command is %s", command); if (do_lexer_routine(&token, command)) { ft_dprintf(2, "{red}%s: syntax error in command substitution{eoc}\n", diff --git a/42sh/src/history/list_toolz.c b/42sh/src/history/list_toolz.c index bdf71e76..1c2008fa 100644 --- a/42sh/src/history/list_toolz.c +++ b/42sh/src/history/list_toolz.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/17 11:37:47 by gwojda #+# #+# */ -/* Updated: 2017/03/16 12:10:14 by gwojda ### ########.fr */ +/* Updated: 2017/03/20 18:16:45 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -18,7 +18,6 @@ void free_history_list(t_list_history *head) if (!head) return ; - DG("free hist"); if (head->next) free(head->next); while (head) diff --git a/42sh/src/main/main.c b/42sh/src/main/main.c index f5f5a4d6..b9478e50 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/20 14:46:44 by gwojda ### ########.fr */ +/* Updated: 2017/03/20 18:12:18 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -65,10 +65,8 @@ int main(int ac, char **av) g_argv = av; setlocale(LC_ALL, ""); - DG("{inv}{bol}{gre}start of shell{eoc}"); if (shell_init(ac, av) != 0) return (1); - DG("JOBC is %s", SH_HAS_JOBC(data_singleton()->opts) ? "ON" : "OFF"); token = NULL; ast = NULL; data = data_singleton(); diff --git a/42sh/src/main/shell_init.c b/42sh/src/main/shell_init.c index 0dc2c0f3..0def2805 100644 --- a/42sh/src/main/shell_init.c +++ b/42sh/src/main/shell_init.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/12 17:23:59 by jhalford #+# #+# */ -/* Updated: 2017/03/20 14:54:28 by gwojda ### ########.fr */ +/* Updated: 2017/03/20 18:12:27 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -100,22 +100,17 @@ int shell_init(int ac, char **av) t_data *data; data = data_singleton(); - DG(); if (data_init(ac, av) < 0) return (-1); - DG(); if (cliopts_get(av, g_opts, data)) { usage(); return (ft_perror()); } - DG(); if (!isatty(STDIN) || *data->av_data) data->opts &= ~(SH_INTERACTIVE | SH_OPTS_JOBC); - DG(); if ((data->fd = get_input_fd(data)) < 0) return (-1); - DG(); if (SH_IS_INTERACTIVE(data->opts) && interactive_settings() < 0) return (-1); return (0); diff --git a/42sh/src/parser/add_bang.c b/42sh/src/parser/add_bang.c index 6a6752fb..a4ca0eb6 100644 --- a/42sh/src/parser/add_bang.c +++ b/42sh/src/parser/add_bang.c @@ -6,7 +6,7 @@ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/10 14:57:45 by ariard #+# #+# */ -/* Updated: 2017/03/13 20:36:01 by ariard ### ########.fr */ +/* Updated: 2017/03/20 18:11:11 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -55,7 +55,6 @@ int add_bang(t_btree **ast, t_list **lst) t_astnode *node; t_token *token; - DG("add bang"); token = (*lst)->content; node = (*ast)->item; if ((token->type == TK_CASE || token->type == TK_WHILE diff --git a/42sh/src/parser/add_condition.c b/42sh/src/parser/add_condition.c index db5ea7de..65f4e323 100644 --- a/42sh/src/parser/add_condition.c +++ b/42sh/src/parser/add_condition.c @@ -1,12 +1,12 @@ /* ************************************************************************** */ /* */ /* ::: :::::::: */ -/* add_if.c :+: :+: :+: */ +/* add_condition.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: ariard +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/10 17:06:16 by ariard #+# #+# */ -/* Updated: 2017/03/13 20:46:40 by ariard ### ########.fr */ +/* Updated: 2017/03/20 18:11:18 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -88,7 +88,6 @@ int add_if(t_btree **ast, t_list **lst) t_token *token; t_astnode *node; - DG("add if"); token = (*lst)->content; node = (*ast)->item; node->type = TK_IF;