From 065aacaadd1de89c2a8842dded94799f983f336e Mon Sep 17 00:00:00 2001 From: Jack Halford Date: Fri, 3 Feb 2017 17:36:07 +0100 Subject: [PATCH] removed debug messages from completion --- 42sh/includes/lexer.h | 2 +- 42sh/src/completion/c_binary.c | 5 +---- 42sh/src/completion/c_clear.c | 2 +- 42sh/src/completion/c_files.c | 6 +----- 42sh/src/completion/c_init.c | 2 +- 42sh/src/completion/c_output.c | 6 +----- 42sh/src/completion/c_parser.c | 5 ++--- 42sh/src/completion/c_pathsolver.c | 2 +- 42sh/src/completion/c_printer.c | 3 +-- 42sh/src/completion/c_terminal.c | 4 +--- 42sh/src/completion/completion.c | 17 +---------------- 42sh/src/exec/exec_command.c | 2 +- 42sh/src/main/main.c | 2 +- 13 files changed, 14 insertions(+), 44 deletions(-) diff --git a/42sh/includes/lexer.h b/42sh/includes/lexer.h index 8e111ad3..10f600a7 100644 --- a/42sh/includes/lexer.h +++ b/42sh/includes/lexer.h @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/01 12:15:50 by jhalford #+# #+# */ -/* Updated: 2017/02/03 15:35:01 by jhalford ### ########.fr */ +/* Updated: 2017/02/03 17:31:08 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/completion/c_binary.c b/42sh/src/completion/c_binary.c index 9aa4fb75..555488a7 100644 --- a/42sh/src/completion/c_binary.c +++ b/42sh/src/completion/c_binary.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/09 13:30:57 by alao #+# #+# */ -/* Updated: 2017/02/03 13:30:59 by alao ### ########.fr */ +/* Updated: 2017/02/03 17:31:46 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -23,18 +23,15 @@ int c_seek_binary(t_data *s, t_comp *c) char **paths; int i; - DG("SB: Start"); i = 0; tmp = NULL; if (!(tmp = ft_strdup(ft_getenv(s->env, "PATH")))) return (-1); - DG("SB: Path extracted [%s]", tmp); paths = ft_strsplit(tmp, ':'); c->match = ft_strdup(c->rcmd); while (paths[i]) c_parser(c, paths[i++], c->rcmd); tmp ? ft_memdel((void *)&tmp) : (0); paths ? ft_sstrfree(paths) : (0); - DG("SB: End"); return (0); } diff --git a/42sh/src/completion/c_clear.c b/42sh/src/completion/c_clear.c index 1cc89271..57141311 100644 --- a/42sh/src/completion/c_clear.c +++ b/42sh/src/completion/c_clear.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/10 11:37:43 by alao #+# #+# */ -/* Updated: 2017/01/31 18:55:16 by alao ### ########.fr */ +/* Updated: 2017/02/03 17:32:05 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/completion/c_files.c b/42sh/src/completion/c_files.c index 005fb857..3eb56993 100644 --- a/42sh/src/completion/c_files.c +++ b/42sh/src/completion/c_files.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/09 13:31:21 by alao #+# #+# */ -/* Updated: 2017/02/03 13:30:50 by alao ### ########.fr */ +/* Updated: 2017/02/03 17:32:20 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -39,7 +39,6 @@ static char *c_slicer(t_comp *c) rt = ft_strsub(tmp, 0, i); if (i <= (int)ft_strlen(tmp) - i + 1) c->match = ft_strsub(tmp, i, ft_strlen(tmp) - i); - DG("From [%s] to path [%s] and match [%s]", tmp, rt, c->match); tmp ? ft_memdel((void *)&tmp) : (0); return (rt); } @@ -52,13 +51,10 @@ int c_seek_files(t_data *s, t_comp *c) { char *path; - DG("SF: Start"); (void)s; path = c_slicer(c); c->cpath = path_solver(c, path, NULL); - DG("Solved as [%s]", c->cpath); path ? ft_memdel((void *)&path) : (0); c_parser(c, c->cpath, c->match); - DG("SF: End"); return (0); } diff --git a/42sh/src/completion/c_init.c b/42sh/src/completion/c_init.c index f54a37a1..0b045bff 100644 --- a/42sh/src/completion/c_init.c +++ b/42sh/src/completion/c_init.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/09 11:21:16 by alao #+# #+# */ -/* Updated: 2017/02/03 13:38:53 by alao ### ########.fr */ +/* Updated: 2017/02/03 17:32:24 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/completion/c_output.c b/42sh/src/completion/c_output.c index 8fb7fd08..bd37994f 100644 --- a/42sh/src/completion/c_output.c +++ b/42sh/src/completion/c_output.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/03 13:10:38 by alao #+# #+# */ -/* Updated: 2017/02/03 16:12:00 by gwojda ### ########.fr */ +/* Updated: 2017/02/03 17:32:36 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -26,8 +26,6 @@ int c_updater(t_comp *c, char *select) char *rt; int new_pos; - DG("\tUpdater"); - DG("RCMD [%s] match [%s] Candidat [%s]", c->rcmd, c->match, select); tmp = NULL; rt = NULL; new_pos = c->ircmd + (ft_strlen(select) - ft_strlen(c->match)) + 1; @@ -39,7 +37,6 @@ int c_updater(t_comp *c, char *select) else data_singleton()->line.input = ft_strdup(rt); data_singleton()->line.pos = new_pos; - DG("Resulting RCMD [%s] with pos [%d] from [%d]", rt, new_pos, c->ircmd); rt ? ft_memdel((void *)&rt) : (0); c_clear(data_singleton()); return (1); @@ -54,7 +51,6 @@ int c_gtfo(t_comp *c, long int keypress) { t_clst *ptr; - DG("It's time to GTFO. Keypress [%d]", keypress); if (keypress != 10) { c_clear(data_singleton()); diff --git a/42sh/src/completion/c_parser.c b/42sh/src/completion/c_parser.c index 90d5c717..08011808 100644 --- a/42sh/src/completion/c_parser.c +++ b/42sh/src/completion/c_parser.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/09 13:52:07 by alao #+# #+# */ -/* Updated: 2017/02/03 13:40:14 by alao ### ########.fr */ +/* Updated: 2017/02/03 17:35:47 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -18,7 +18,6 @@ static void c_add_to_lst(t_comp *c, t_clst *node) { - DG("PARSER: Adding node [%s]", node->name); if (c->lst == NULL) { c->lst = node; @@ -71,7 +70,7 @@ int c_parser(t_comp *c, char *path, char *name) DIR *rep; struct dirent *dirc; - DG("PARSER: Search for [%s] in [%s]", name, path); + (void)name; if (!(rep = opendir(path))) return (-1); while ((dirc = readdir(rep))) diff --git a/42sh/src/completion/c_pathsolver.c b/42sh/src/completion/c_pathsolver.c index adbf7c8f..140dae2d 100644 --- a/42sh/src/completion/c_pathsolver.c +++ b/42sh/src/completion/c_pathsolver.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/10/25 18:21:54 by alao #+# #+# */ -/* Updated: 2017/01/11 14:14:09 by alao ### ########.fr */ +/* Updated: 2017/02/03 17:32:50 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/completion/c_printer.c b/42sh/src/completion/c_printer.c index 9162bf7f..2a529fc6 100644 --- a/42sh/src/completion/c_printer.c +++ b/42sh/src/completion/c_printer.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/10 12:55:39 by alao #+# #+# */ -/* Updated: 2017/01/19 15:49:34 by alao ### ########.fr */ +/* Updated: 2017/02/03 17:35:15 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -21,7 +21,6 @@ static void c_printer_node(t_clst *lst) { - DG("File [%s] type [%d]", lst->name, (int)lst->type); lst->cursor ? ft_putstr(tgetstr("us", NULL)) : (0); lst->cursor ? (ft_putstr_fd("\033[31m", 2)) : (0); lst->type == 4 ? ft_putstr_fd("\e[1;31m", 2) : (0); diff --git a/42sh/src/completion/c_terminal.c b/42sh/src/completion/c_terminal.c index 04b94f05..42245c97 100644 --- a/42sh/src/completion/c_terminal.c +++ b/42sh/src/completion/c_terminal.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/10/11 10:44:40 by alao #+# #+# */ -/* Updated: 2017/02/03 13:40:41 by alao ### ########.fr */ +/* Updated: 2017/02/03 17:33:08 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -23,7 +23,6 @@ void c_term_mv_back(t_comp *c) int lcmd; i = 0; - DG("Terminal back up"); while (i != (c->c_line)) { ft_putstr(tgetstr("up", NULL)); @@ -50,7 +49,6 @@ void c_term_mv_down(t_comp *c) int i; i = 0; - DG("Terminal down"); while (i < c->c_line) { ft_putstr(tgetstr("do", NULL)); diff --git a/42sh/src/completion/completion.c b/42sh/src/completion/completion.c index af316a74..e8d70302 100644 --- a/42sh/src/completion/completion.c +++ b/42sh/src/completion/completion.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/09/20 14:50:33 by alao #+# #+# */ -/* Updated: 2017/02/03 15:47:19 by alao ### ########.fr */ +/* Updated: 2017/02/03 17:33:41 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ @@ -21,33 +21,20 @@ int test(t_comp *c) t_clst *tmp; int i; - DG("\tAutocompletion dump"); i = 1; if (!(c->lst)) { - DG("Empty list"); return (0); } - if (c->lst && c->lst->cursor) - DG("Node [x] ID [%d] [%s]", c->lst->id, c->lst->name); - else - DG("Node [ ] ID [%d] [%s]", c->lst->id, c->lst->name); if (c->lst->prev != c->lst) { tmp = c->lst->next; while (tmp != c->lst) { - if (tmp->cursor) - DG("Node [x] ID [%d] [%s]", tmp->id, tmp->name); - else - DG("Node [ ] ID [%d] [%s]", tmp->id, tmp->name); i++; tmp = tmp->next; } } - DG("List configuration as:"); - DG("Max value: Length (X) %d Number (Y) %d", c->c_sx, c->c_sy); - DG("Translated to [%d] Lines and [%d] Column", c->c_line, c->c_pline); return (0); } @@ -79,7 +66,6 @@ static int c_dispatcher(t_data *s) { if (s->comp && s->comp->lst == NULL) { - DG("Empty list, flushing autocompletion"); c_clear(s); } else if (s->comp && s->comp->lst == s->comp->lst->next) @@ -117,7 +103,6 @@ int completion(long int keypress) t_data *s; s = data_singleton(); - DG("\n\n\t\tAutocompletion input key [%d]\n", (int)keypress); if (s->comp == NULL) { if (s->line.pos == 0) diff --git a/42sh/src/exec/exec_command.c b/42sh/src/exec/exec_command.c index 54693a6a..0a5a2721 100644 --- a/42sh/src/exec/exec_command.c +++ b/42sh/src/exec/exec_command.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/11/14 17:28:14 by jhalford #+# #+# */ -/* Updated: 2017/02/03 15:47:38 by jhalford ### ########.fr */ +/* Updated: 2017/02/03 17:30:08 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/main/main.c b/42sh/src/main/main.c index 17f8fbba..86709d2e 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/02/03 15:17:56 by jhalford ### ########.fr */ +/* Updated: 2017/02/03 17:33:56 by jhalford ### ########.fr */ /* */ /* ************************************************************************** */