maj bug completion + fin mise a la norme

This commit is contained in:
gwojda 2017-03-16 10:29:46 +01:00
parent 1e4863311e
commit 8ffd499c97
4 changed files with 11 additions and 40 deletions

View file

@ -6,7 +6,7 @@
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */ /* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/10 09:04:42 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. ** 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 ** lst_modulo is the number in element in the last column of the list that is
** not perfectly in the same size. ** not perfectly in the same size.
**
*/ */
static int c_idsolver(t_comp *c, int ids, int ids_bk) static int c_idsolver(t_comp *c, int ids, int ids_bk)

View file

@ -6,7 +6,7 @@
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */ /* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/10/15 13:27:14 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. ** 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; size_t pos;

View file

@ -6,7 +6,7 @@
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */ /* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/15 12:03:30 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) else if (c->lst == c->lst->next)
return (1); return (1);
ft_print(keypress); ft_print(keypress);
return(1); return (1);
} }
else else
{ {

View file

@ -6,7 +6,7 @@
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */ /* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/09 13:52:07 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 ** 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) 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. ** 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; t_clst *tmp;
if (!(c->match && ft_strncmp(".", c->match, 1) == 0) && 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); return (0);
if (c->match && ft_strnequ(c->match, value, ft_strlen(c->match)) != 1) if (!ft_strcmp(value, ".") || !ft_strcmp(value, ".."))
return (0); 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) if (c->match && ft_strnequ(c->match, value, ft_strlen(c->match)) != 1)
return (0); return (0);
if (!(tmp = (t_clst *)malloc(sizeof(t_clst)))) 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. ** 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; DIR *rep;
struct dirent *dirc; struct dirent *dirc;