diff options
Diffstat (limited to 'src/eval/exec.c')
| -rw-r--r-- | src/eval/exec.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/eval/exec.c b/src/eval/exec.c index e41f994..fb97bdc 100644 --- a/src/eval/exec.c +++ b/src/eval/exec.c @@ -6,7 +6,7 @@ /* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/04/01 17:06:11 by charles #+# #+# */ -/* Updated: 2020/04/01 17:06:12 by charles ### ########.fr */ +/* Updated: 2020/07/18 09:39:53 by charles ### ########.fr */ /* */ /* ************************************************************************** */ @@ -23,12 +23,12 @@ ** \return True if valid */ -bool exec_is_path(char *exec_name) -{ - return (ft_strncmp(exec_name, "../", 3) == 0 - || ft_strncmp(exec_name, "./", 2) == 0 - || ft_strncmp(exec_name, "/", 1) == 0); -} +/* bool exec_is_path(char *exec_name) */ +/* { */ +/* return (ft_strncmp(exec_name, "../", 3) == 0 */ +/* || ft_strncmp(exec_name, "./", 2) == 0 */ +/* || ft_strncmp(exec_name, "/", 1) == 0); */ +/* } */ /* ** \brief Check if executable path is valid @@ -60,13 +60,13 @@ char *exec_search_path(t_path path, char *path_var, char *exec_name) { char *exec_path; - if (exec_is_path(exec_name)) + if (ft_strchr(exec_name, '/') != NULL) // TODO test recursive link return (exec_name); - // try current first + // TODO if PATH contain empty path, consider current directory files as cmd if ((exec_path = ft_htget(path, exec_name)) == NULL) { - if (path_update(path, path_var) == NULL) // optimise by not updating not changed path in ht - return (NULL); + if (path_update(path, path_var) == NULL) // optimise by not updating not changed path in ht + return (NULL); // FIXME need to distiguish between malloc error and cmd not found error if ((exec_path = ft_htget(path, exec_name)) == NULL) return (NULL); } |
