j'avais fait des betises

This commit is contained in:
gwojda 2017-03-08 13:48:37 +01:00
parent 4d805a1c74
commit 301ec53259
3 changed files with 28 additions and 10 deletions

View file

@ -6,7 +6,7 @@
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/02/18 11:13:04 by alao #+# #+# */
/* Updated: 2017/03/08 13:34:05 by gwojda ### ########.fr */
/* Updated: 2017/03/08 13:46:51 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
@ -162,10 +162,4 @@ int c_spacing_clear(t_comp *c);
int ft_sstrlen(char **s);
char *ft_sstrtostr(char **s, char *sep);
/*
** yolo je mets ca au pif - gwojda
*/
int c_exclusion_folder(t_comp *c);
#endif

View file

@ -6,7 +6,7 @@
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/09 13:31:21 by alao #+# #+# */
/* Updated: 2017/03/08 13:33:13 by gwojda ### ########.fr */
/* Updated: 2017/03/08 13:46:46 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
@ -20,7 +20,7 @@
** Returning 1 if success (trigger an update) or 0.
*/
int c_exclusion_folder(t_comp *c)
static int c_exclusion_folder(t_comp *c)
{
DIR *rep;
char *tmp;

View file

@ -6,12 +6,36 @@
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/10/15 13:27:14 by alao #+# #+# */
/* Updated: 2017/03/08 13:33:10 by gwojda ### ########.fr */
/* Updated: 2017/03/08 13:47:34 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
#include "completion.h"
static int c_exclusion_folder(t_comp *c)
{
DIR *rep;
char *tmp;
char *tmp2;
tmp = ft_strjoin(c->cpath, c->match);
tmp2 = NULL;
if (tmp[ft_strlen(tmp) - 1] == '/')
return (0);
if ((rep = opendir(tmp)) && (!closedir(rep)))
{
tmp ? ft_memdel((void *)&tmp) : (0);
tmp2 = ft_strjoin(c->match, "/");
c_updater(c, tmp2);
tmp2 ? ft_memdel((void *)&tmp2) : (0);
ft_strdel(&c->match);
c->match = ft_strdup("/");
return (1);
}
tmp ? ft_memdel((void *)&tmp) : (0);
tmp ? ft_memdel((void *)&tmp) : (0);
return (0);
}
/*
** Start the parsing for the autocompletion.
** Check the first char of the c->rcmd for a . or /. to see if it's a local