Merge branch 'master' of https://github.com/jzck/42sh
This commit is contained in:
commit
a5247bea82
12 changed files with 28 additions and 25 deletions
|
|
@ -6,14 +6,14 @@
|
|||
# By: wescande <wescande@student.42.fr> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2016/08/29 21:32:58 by wescande #+# #+# #
|
||||
# Updated: 2017/03/21 13:38:09 by jhalford ### ########.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)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
# By: jhalford <jack@crans.org> +#+ +:+ +#+ #
|
||||
# +#+#+#+#+#+ +#+ #
|
||||
# Created: 2017/02/07 16:09:36 by jhalford #+# #+# #
|
||||
# Updated: 2017/03/20 12:05:06 by wescande ### ########.fr #
|
||||
# Updated: 2017/03/21 12:25:27 by gwojda ### ########.fr #
|
||||
# #
|
||||
# **************************************************************************** #
|
||||
|
||||
|
|
@ -17,9 +17,9 @@ AR = ar -rc
|
|||
MKDIR = mkdir -p
|
||||
RM = /bin/rm -rf
|
||||
|
||||
W_FLAGS = -Wall -Wextra -Werror
|
||||
W_FLAGS = -Wall -Wextra -Werror -g
|
||||
D_FLAGS = -g
|
||||
V_FLAGS = -fvisibility=hidden
|
||||
V_FLAGS = #-fvisibility=hidden
|
||||
FLAGS = $(W_FLAGS) $(D_FLAGS) $(V_FLAGS)
|
||||
|
||||
DELTA = $$(echo "$$(tput cols)-47"|bc)
|
||||
|
|
|
|||
|
|
@ -3,10 +3,10 @@
|
|||
/* ::: :::::::: */
|
||||
/* ft_strsub.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: jhalford <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2016/11/03 14:58:43 by jhalford #+# #+# */
|
||||
/* Updated: 2016/11/25 11:31:36 by jhalford ### ########.fr */
|
||||
/* Updated: 2017/03/21 11:38:40 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/10 11:37:43 by alao #+# #+# */
|
||||
/* Updated: 2017/03/17 16:46:20 by gwojda ### ########.fr */
|
||||
/* Updated: 2017/03/21 14:02:41 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -65,5 +65,6 @@ int c_clear(t_data *s)
|
|||
c_clear_lst(ptr);
|
||||
s->comp ? ft_memdel((void *)&s->comp) : (0);
|
||||
s->comp = NULL;
|
||||
data_singleton()->comp = NULL;
|
||||
return (0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/09 16:54:59 by gwojda #+# #+# */
|
||||
/* Updated: 2017/03/19 15:22:06 by gwojda ### ########.fr */
|
||||
/* Updated: 2017/03/21 14:47:18 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/09 13:31:21 by alao #+# #+# */
|
||||
/* Updated: 2017/03/18 09:18:04 by alao ### ########.fr */
|
||||
/* Updated: 2017/03/21 14:53:21 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -31,7 +31,8 @@ int c_exclusion_folder(t_comp *c)
|
|||
if ((rep = opendir(tmp)) && (!closedir(rep)))
|
||||
{
|
||||
tmp ? ft_memdel((void *)&tmp) : (0);
|
||||
if (c->rcmd[ft_strlen(c->rcmd) - 1] == '/')
|
||||
if (c->rcmd[ft_strlen(c->rcmd) - 1] == '/'
|
||||
|| c->rcmd[ft_strlen(c->rcmd) - 1] == '.')
|
||||
{
|
||||
c_clear(data_singleton());
|
||||
return (0);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/09 11:21:16 by alao #+# #+# */
|
||||
/* Updated: 2017/03/17 16:51:46 by gwojda ### ########.fr */
|
||||
/* Updated: 2017/03/21 11:39:22 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ static char *c_trimmer(char *cmd, int st, int nd)
|
|||
st = 0;
|
||||
while (rt[st] == ' ')
|
||||
st++;
|
||||
tmp = ft_strsub(rt, st, ft_strlen(rt));
|
||||
tmp = ft_strsub(rt, st, ft_strlen(rt) - st);
|
||||
if (st)
|
||||
data_singleton()->comp->between = ft_strsub(rt, 0, st);
|
||||
rt ? ft_memdel((void *)&rt) : (0);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/03/08 17:20:01 by gwojda #+# #+# */
|
||||
/* Updated: 2017/03/21 10:09:42 by gwojda ### ########.fr */
|
||||
/* Updated: 2017/03/21 13:40:42 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -78,9 +78,8 @@ static int c_check_glob(char **ss_glob, char *current_word,
|
|||
str = data_singleton()->line.input;
|
||||
free(current_word);
|
||||
free(glob_echap);
|
||||
if (!*ss_glob || !**ss_glob)
|
||||
return (1);
|
||||
if (!ft_strncmp(str + pos, *ss_glob, ft_strlen(*ss_glob)))
|
||||
if (!*ss_glob || !**ss_glob ||
|
||||
!ft_strncmp(str + pos, *ss_glob, ft_strlen(*ss_glob)))
|
||||
{
|
||||
ft_sstrfree(ss_glob);
|
||||
return (1);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/15 12:03:30 by alao #+# #+# */
|
||||
/* Updated: 2017/03/19 15:28:50 by gwojda ### ########.fr */
|
||||
/* Updated: 2017/03/21 15:03:37 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -55,9 +55,9 @@ int c_rematch(t_comp *c, long int keypress)
|
|||
c_refresh_match(c, keypress);
|
||||
c_clear_lst(c);
|
||||
c_matching(data_singleton(), c);
|
||||
if (c->lst == NULL)
|
||||
if (data_singleton()->comp && c->lst == NULL)
|
||||
c_clear(data_singleton());
|
||||
else if (c->lst == c->lst->next)
|
||||
else if (data_singleton()->comp && c->lst == c->lst->next)
|
||||
return (1);
|
||||
ft_print(keypress, &data_singleton()->line.input,
|
||||
&data_singleton()->line.pos);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/02/03 13:10:38 by alao #+# #+# */
|
||||
/* Updated: 2017/03/19 15:18:55 by gwojda ### ########.fr */
|
||||
/* Updated: 2017/03/21 14:37:14 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -33,7 +33,7 @@ static int c_updater_rcmd(t_comp *c)
|
|||
ft_memdel((void *)&data_singleton()->line.input);
|
||||
data_singleton()->line.input = ft_strdup(c->rcmd);
|
||||
}
|
||||
new_pos = ft_strlen(c->start) + ft_strlen(c->between) + ft_strlen(c->rcmd);
|
||||
new_pos = ft_strlen(c->rcmd);
|
||||
data_singleton()->line.pos = new_pos;
|
||||
tmp ? ft_memdel((void *)&tmp) : (0);
|
||||
tmp2 ? ft_memdel((void *)&tmp2) : (0);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2017/01/09 13:52:07 by alao #+# #+# */
|
||||
/* Updated: 2017/03/16 10:29:15 by gwojda ### ########.fr */
|
||||
/* Updated: 2017/03/21 14:46:39 by gwojda ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue