From 787b1d280adcf13c01ee92346e1f38841cc6c3cb Mon Sep 17 00:00:00 2001 From: gwojda Date: Tue, 21 Mar 2017 15:11:20 +0100 Subject: [PATCH] fix bug exec --- 42sh/Makefile | 4 ++-- 42sh/src/completion/c_match_update.c | 5 +---- 42sh/src/exec/ft_findexec.c | 6 ++++-- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/42sh/Makefile b/42sh/Makefile index e3247c72..55b6f70e 100644 --- a/42sh/Makefile +++ b/42sh/Makefile @@ -6,14 +6,14 @@ # By: wescande +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2016/08/29 21:32:58 by wescande #+# #+# # -# Updated: 2017/03/21 14:55:42 by gwojda ### ########.fr # +# Updated: 2017/03/21 15:06:37 by gwojda ### ########.fr # # # # **************************************************************************** # NAME = 42sh CC = gcc -FLAGS = -Wall -Wextra -Werror -fvisibility=hidden #-fsanitize=address +FLAGS = -Wall -Wextra -Werror #-fvisibility=hidden #-fsanitize=address D_FLAGS = -g DELTA = $$(echo "$$(tput cols)-47"|bc) diff --git a/42sh/src/completion/c_match_update.c b/42sh/src/completion/c_match_update.c index 03ddda9a..9fa54ace 100644 --- a/42sh/src/completion/c_match_update.c +++ b/42sh/src/completion/c_match_update.c @@ -6,7 +6,7 @@ /* By: alao +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/15 12:03:30 by alao #+# #+# */ -/* Updated: 2017/03/21 14:23:01 by gwojda ### ########.fr */ +/* Updated: 2017/03/21 15:03:37 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -50,20 +50,17 @@ int c_rematch(t_comp *c, long int keypress) { if (ft_isascii(keypress)) { - DG("before rematch = \"%s\"", data_singleton()->line.input); c->isrematch = 1; c_term_clear(c); c_refresh_match(c, keypress); c_clear_lst(c); c_matching(data_singleton(), c); - DG("after matching = \"%s\"", data_singleton()->line.input); if (data_singleton()->comp && c->lst == NULL) c_clear(data_singleton()); else if (data_singleton()->comp && c->lst == c->lst->next) return (1); ft_print(keypress, &data_singleton()->line.input, &data_singleton()->line.pos); - DG("after rematch = \"%s\"", data_singleton()->line.input); return (1); } else diff --git a/42sh/src/exec/ft_findexec.c b/42sh/src/exec/ft_findexec.c index cbc4545d..acb87a63 100644 --- a/42sh/src/exec/ft_findexec.c +++ b/42sh/src/exec/ft_findexec.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/03 13:37:49 by jhalford #+# #+# */ -/* Updated: 2017/03/20 16:52:10 by gwojda ### ########.fr */ +/* Updated: 2017/03/21 15:11:09 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -30,6 +30,7 @@ char *ft_findexec(char *path, char *file) DIR *dir; char **spath; struct dirent *dirent; + char *execpath; i = -1; spath = ft_strsplit(path, ':'); @@ -41,8 +42,9 @@ char *ft_findexec(char *path, char *file) { if (ft_strcmp(dirent->d_name, file)) continue ; + execpath = create_path(spath[i], dirent->d_name, spath); closedir(dir); - return (create_path(spath[i], dirent->d_name, spath)); + return (execpath); } closedir(dir); }