Clean-up: normed out files
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/09/26 16:25:00 by tmaze #+# #+# */
|
||||
/* Updated: 2019/10/10 14:05:31 by tmaze ### ########.fr */
|
||||
/* Updated: 2019/10/17 11:01:38 by tmaze ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -78,7 +78,7 @@ char *check_path_dot(char *exec, t_env *env)
|
||||
put_error(exec, "permission denied");
|
||||
ft_strdel(&ret);
|
||||
return (exec);
|
||||
}
|
||||
}
|
||||
put_error(exec, "no such file or directory");
|
||||
ft_strdel(&ret);
|
||||
return (exec);
|
||||
@@ -96,19 +96,9 @@ char *check_path(char *exec, t_env *env)
|
||||
if (exec)
|
||||
{
|
||||
if (ft_isin(exec, '/') != -1 && ft_isin(exec, '.') == -1)
|
||||
{
|
||||
if ((ret = check_path_slash(exec)) != NULL)
|
||||
return (ret);
|
||||
else
|
||||
return (NULL);
|
||||
}
|
||||
return (check_path_slash(exec));
|
||||
if (exec[0] == '.')
|
||||
{
|
||||
if ((ret = check_path_dot(exec, env)) != NULL)
|
||||
return (ret);
|
||||
else
|
||||
return (NULL);
|
||||
}
|
||||
return (check_path_dot(exec, env));
|
||||
if ((path = lstgetelem("PATH", env)) == NULL
|
||||
|| path->val == NULL
|
||||
|| (path_elems = ft_strsplit(path->val, ':')) == NULL)
|
||||
@@ -135,6 +125,9 @@ char *check_path(char *exec, t_env *env)
|
||||
if (access(ret, X_OK) == 0)
|
||||
break ;
|
||||
put_error(exec, "permission denied");
|
||||
ft_strdel(&ret);
|
||||
ft_del_words_tables(&path_elems);
|
||||
return (NULL);
|
||||
}
|
||||
ft_strdel(&ret);
|
||||
i++;
|
||||
@@ -156,6 +149,7 @@ int exec_cmd(char **argv, t_env **env)
|
||||
return (-1);
|
||||
if ((path = check_path(argv[0], *env)) == NULL)
|
||||
ft_del_words_tables(&env_tab);
|
||||
ft_printf("path after resolve: %s\n", path);
|
||||
if (path == NULL)
|
||||
return (-1);
|
||||
if ((ret = fork()) == 0)
|
||||
|
||||
Reference in New Issue
Block a user