fix bug exec

This commit is contained in:
gwojda 2017-03-21 15:11:20 +01:00
parent cc4a088f29
commit 787b1d280a
3 changed files with 7 additions and 8 deletions

View file

@ -6,14 +6,14 @@
# By: wescande <wescande@student.42.fr> +#+ +:+ +#+ # # By: wescande <wescande@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ # # +#+#+#+#+#+ +#+ #
# Created: 2016/08/29 21:32:58 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 NAME = 42sh
CC = gcc CC = gcc
FLAGS = -Wall -Wextra -Werror -fvisibility=hidden #-fsanitize=address FLAGS = -Wall -Wextra -Werror #-fvisibility=hidden #-fsanitize=address
D_FLAGS = -g D_FLAGS = -g
DELTA = $$(echo "$$(tput cols)-47"|bc) DELTA = $$(echo "$$(tput cols)-47"|bc)

View file

@ -6,7 +6,7 @@
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */ /* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/15 12:03:30 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)) if (ft_isascii(keypress))
{ {
DG("before rematch = \"%s\"", data_singleton()->line.input);
c->isrematch = 1; c->isrematch = 1;
c_term_clear(c); c_term_clear(c);
c_refresh_match(c, keypress); c_refresh_match(c, keypress);
c_clear_lst(c); c_clear_lst(c);
c_matching(data_singleton(), c); c_matching(data_singleton(), c);
DG("after matching = \"%s\"", data_singleton()->line.input);
if (data_singleton()->comp && c->lst == NULL) if (data_singleton()->comp && c->lst == NULL)
c_clear(data_singleton()); c_clear(data_singleton());
else if (data_singleton()->comp && c->lst == c->lst->next) else if (data_singleton()->comp && c->lst == c->lst->next)
return (1); return (1);
ft_print(keypress, &data_singleton()->line.input, ft_print(keypress, &data_singleton()->line.input,
&data_singleton()->line.pos); &data_singleton()->line.pos);
DG("after rematch = \"%s\"", data_singleton()->line.input);
return (1); return (1);
} }
else else

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */ /* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/03 13:37:49 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; DIR *dir;
char **spath; char **spath;
struct dirent *dirent; struct dirent *dirent;
char *execpath;
i = -1; i = -1;
spath = ft_strsplit(path, ':'); spath = ft_strsplit(path, ':');
@ -41,8 +42,9 @@ char *ft_findexec(char *path, char *file)
{ {
if (ft_strcmp(dirent->d_name, file)) if (ft_strcmp(dirent->d_name, file))
continue ; continue ;
execpath = create_path(spath[i], dirent->d_name, spath);
closedir(dir); closedir(dir);
return (create_path(spath[i], dirent->d_name, spath)); return (execpath);
} }
closedir(dir); closedir(dir);
} }