on compile mnt
This commit is contained in:
parent
34ea7ec36a
commit
7508a136b2
4 changed files with 33 additions and 40 deletions
|
|
@ -45,6 +45,7 @@ builtin/builtin_unset.c\
|
||||||
builtin/builtin_unsetenv.c\
|
builtin/builtin_unsetenv.c\
|
||||||
builtin/is_builtin.c\
|
builtin/is_builtin.c\
|
||||||
c_seek_env.c\
|
c_seek_env.c\
|
||||||
|
completion/c_abs_path.c\
|
||||||
completion/c_binary.c\
|
completion/c_binary.c\
|
||||||
completion/c_clear.c\
|
completion/c_clear.c\
|
||||||
completion/c_files.c\
|
completion/c_files.c\
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/02/18 11:13:04 by alao #+# #+# */
|
/* Created: 2016/02/18 11:13:04 by alao #+# #+# */
|
||||||
/* Updated: 2017/03/09 15:58:27 by gwojda ### ########.fr */
|
/* Updated: 2017/03/09 17:34:53 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -167,7 +167,8 @@ char *ft_sstrtostr(char **s, char *sep);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int c_glob_matching(void);
|
int c_glob_matching(void);
|
||||||
int c_seek_env(t_comp *c, char *current_word);
|
|
||||||
void c_add_to_lst(t_comp *c, t_clst *node);
|
void c_add_to_lst(t_comp *c, t_clst *node);
|
||||||
|
int c_seek_env(t_comp *c, char *current_word);
|
||||||
|
void c_seek_abs_path(t_comp *c, char *current_word);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -6,14 +6,39 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/03/09 16:54:59 by gwojda #+# #+# */
|
/* Created: 2017/03/09 16:54:59 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/03/09 16:55:45 by gwojda ### ########.fr */
|
/* Updated: 2017/03/09 17:34:43 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "completion.h"
|
#include "completion.h"
|
||||||
|
|
||||||
void c_seek_abs_path(t_comp *c)
|
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);
|
||||||
|
return (1);
|
||||||
|
}
|
||||||
|
tmp ? ft_memdel((void *)&tmp) : (0);
|
||||||
|
tmp ? ft_memdel((void *)&tmp) : (0);
|
||||||
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void c_seek_abs_path(t_comp *c, char *current_word)
|
||||||
|
{
|
||||||
|
char *tmp;
|
||||||
|
|
||||||
c->cpath = ft_strndup(current_word, ft_strrchr(c->rcmd, '/') - current_word + 1);
|
c->cpath = ft_strndup(current_word, ft_strrchr(c->rcmd, '/') - current_word + 1);
|
||||||
if (current_word[0] == '~')
|
if (current_word[0] == '~')
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,34 +6,12 @@
|
||||||
/* 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/09 17:25:06 by gwojda ### ########.fr */
|
/* Updated: 2017/03/09 17:35:01 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
#include "completion.h"
|
#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);
|
|
||||||
return (1);
|
|
||||||
}
|
|
||||||
tmp ? ft_memdel((void *)&tmp) : (0);
|
|
||||||
tmp ? ft_memdel((void *)&tmp) : (0);
|
|
||||||
return (0);
|
|
||||||
}
|
|
||||||
/*
|
/*
|
||||||
** chevron y es-tu ???
|
** chevron y es-tu ???
|
||||||
*/
|
*/
|
||||||
|
|
@ -82,22 +60,10 @@ static char *c_current_words(t_comp *c)
|
||||||
int c_matching(t_data *s, t_comp *c)
|
int c_matching(t_data *s, t_comp *c)
|
||||||
{
|
{
|
||||||
char *current_word;
|
char *current_word;
|
||||||
char *tmp;
|
|
||||||
|
|
||||||
current_word = c_current_words(c);
|
current_word = c_current_words(c);
|
||||||
if (ft_strchr(c->rcmd, '/'))
|
if (ft_strchr(c->rcmd, '/'))
|
||||||
{
|
c_seek_abs_path(c, current_word);
|
||||||
c->cpath = ft_strndup(current_word, ft_strrchr(c->rcmd, '/') - current_word + 1);
|
|
||||||
if (current_word[0] == '~')
|
|
||||||
{
|
|
||||||
tmp = c->cpath;
|
|
||||||
c->cpath = ft_str3join(getenv("PWD"), "/", c->cpath + 2);
|
|
||||||
free(tmp);
|
|
||||||
}
|
|
||||||
!c->match ? c->match = ft_strdupi_w(ft_strrchr(c->rcmd, '/') + 1) : 0;
|
|
||||||
c_parser(c, c->cpath, c->match);
|
|
||||||
c_exclusion_folder(c);
|
|
||||||
}
|
|
||||||
else if (ft_strchr(c->rcmd, '$'))
|
else if (ft_strchr(c->rcmd, '$'))
|
||||||
c_seek_env(c, current_word);
|
c_seek_env(c, current_word);
|
||||||
else if (c->rcmd[0] != '.' && !(ft_strchr(c->rcmd, ' ')) && !c_chevron(c))
|
else if (c->rcmd[0] != '.' && !(ft_strchr(c->rcmd, ' ')) && !c_chevron(c))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue