diff --git a/42sh/src/completion/c_arrow.c b/42sh/src/completion/c_arrow.c index d0246fdd..7ba6fa66 100644 --- a/42sh/src/completion/c_arrow.c +++ b/42sh/src/completion/c_arrow.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/10 09:04:42 by alao #+# #+# */ -/* Updated: 2017/03/16 08:17:12 by alao ### ########.fr */ +/* Updated: 2017/03/16 10:19:54 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,7 +16,6 @@ ** Calculate the offset id value from the current one relative to the list size. ** lst_modulo is the number in element in the last column of the list that is ** not perfectly in the same size. -** */ static int c_idsolver(t_comp *c, int ids, int ids_bk) diff --git a/42sh/src/completion/c_match.c b/42sh/src/completion/c_match.c index 7d85f162..ce15d99e 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/16 09:12:40 by alao ### ########.fr */ +/* Updated: 2017/03/16 10:20:44 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,7 +16,7 @@ ** Failsafe by checking if the nearby char are not a < or > for aggregation. */ -static int c_chevron(t_comp *c) +static int c_chevron(t_comp *c) { size_t pos; diff --git a/42sh/src/completion/c_match_update.c b/42sh/src/completion/c_match_update.c index 5d382df5..e18f456e 100644 --- a/42sh/src/completion/c_match_update.c +++ b/42sh/src/completion/c_match_update.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/15 12:03:30 by alao #+# #+# */ -/* Updated: 2017/03/16 08:08:11 by alao ### ########.fr */ +/* Updated: 2017/03/16 10:21:03 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -60,7 +60,7 @@ int c_rematch(t_comp *c, long int keypress) else if (c->lst == c->lst->next) return (1); ft_print(keypress); - return(1); + return (1); } else { diff --git a/42sh/src/completion/c_parser.c b/42sh/src/completion/c_parser.c index 166716ae..20c8912d 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/03/16 08:49:22 by alao ### ########.fr */ +/* Updated: 2017/03/16 10:29:15 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,7 +16,7 @@ ** Add the matching element to the list */ -void c_add_to_lst(t_comp *c, t_clst *node) +void c_add_to_lst(t_comp *c, t_clst *node) { if (c->lst == NULL) { @@ -41,43 +41,15 @@ void c_add_to_lst(t_comp *c, t_clst *node) ** created and the function above is called to add it. */ -//TODO: The above function doesn't reject . and .. folder for abs_path. Fix needed. - -/* -static int c_storing(t_comp *c, char *value, unsigned char type) +static int c_storing(t_comp *c, char *value, unsigned char type) { t_clst *tmp; if (!(c->match && ft_strncmp(".", c->match, 1) == 0) && - (ft_strncmp(".", value, 1) == 0 || ft_strncmp("..", value, 2) == 0)) + (ft_strncmp(".", value, 1) == 0 || ft_strncmp("..", value, 2) == 0)) return (0); - if (c->match && ft_strnequ(c->match, value, ft_strlen(c->match)) != 1) + if (!ft_strcmp(value, ".") || !ft_strcmp(value, "..")) return (0); - if (!(tmp = (t_clst *)malloc(sizeof(t_clst)))) - return (-1); - tmp->name = ft_strdup(value); - tmp->len = ft_strlen(tmp->name); - tmp->type = (int)type; - tmp->cursor = 0; - c_add_to_lst(c, tmp); - return (0); -} -*/ - -static int c_storing(t_comp *c, char *value, unsigned char type) -{ - t_clst *tmp; - - if (c->match && c->match[0] == '.') - { - if (ft_strequ(".", value) || ft_strequ("..", value)) - return (0); - } - else - { - if (ft_strncmp(".", value, 1) == 0 || ft_strncmp("..", value, 2) == 0) - return (0); - } if (c->match && ft_strnequ(c->match, value, ft_strlen(c->match)) != 1) return (0); if (!(tmp = (t_clst *)malloc(sizeof(t_clst)))) @@ -94,7 +66,7 @@ static int c_storing(t_comp *c, char *value, unsigned char type) ** Cycle through the path specified. */ -int c_parser(t_comp *c, char *path, char *name) +int c_parser(t_comp *c, char *path, char *name) { DIR *rep; struct dirent *dirc;