modif print on DBG 3 et modif glob sur recherche dans le path seulement si =/= '/' et =/= './'

This commit is contained in:
wescande 2017-01-26 17:21:13 +01:00 committed by Jack Halford
parent a0feff2e2a
commit d66a692f8e
2 changed files with 7 additions and 4 deletions

View file

@ -6,7 +6,7 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/04 16:29:54 by wescande #+# #+# */
/* Updated: 2017/01/26 16:04:09 by wescande ### ########.fr */
/* Updated: 2017/01/26 17:18:20 by wescande ### ########.fr */
/* */
/* ************************************************************************** */
@ -52,7 +52,10 @@ char **glob(const char *pat, char **env)
mul_pat = expand_brace(pat);
while (mul_pat->next)
{
if (env && (path = ft_strsplit(ft_getenv(env, "PATH"), ':')))
if (!(((char *)mul_pat->content)[0] == '/'
|| (((char *)mul_pat->content)[0] == '.'
&& ((char *)mul_pat->content)[1] == '/'))
&& env && (path = ft_strsplit(ft_getenv(env, "PATH"), ':')))
{
path_research(mul_pat->content, path, &match);
ft_tabdel(&path);

View file

@ -6,7 +6,7 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/05 16:09:40 by wescande #+# #+# */
/* Updated: 2017/01/12 15:48:03 by wescande ### ########.fr */
/* Updated: 2017/01/26 17:14:32 by wescande ### ########.fr */
/* */
/* ************************************************************************** */
@ -42,7 +42,7 @@ void glob_print(t_list *lst, t_data *data)
;
glob_ret = glob(token->data, data->env);
DG("%02i '%s'", i, token->data);
ft_tabprint_fd(glob_ret, 2);
ft_tabprint_fd(glob_ret, 3);
lst = lst->next;
}
}