fix somes bugs #100

This commit is contained in:
gwojda 2017-03-14 12:14:06 +01:00
parent 21ded04b0d
commit c654e524f4
11 changed files with 28 additions and 22 deletions

View file

@ -263,6 +263,7 @@ line-editing/move_up_and_down.c\
line-editing/print_and_del.c\
line-editing/queue.c\
line-editing/readline.c\
line-editing/resize.c\
main/data_exit.c\
main/data_init.c\
main/data_singleton.c\

View file

@ -6,7 +6,7 @@
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/02/18 11:13:04 by alao #+# #+# */
/* Updated: 2017/03/10 17:38:50 by gwojda ### ########.fr */
/* Updated: 2017/03/14 12:09:55 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
@ -120,7 +120,7 @@ int completion(long int key);
void c_init(t_data *s, long int input);
int c_matching(t_data *s, t_comp *c);
int c_seek_binary(t_data *s, t_comp *c);
int c_seek_files(t_data *s, t_comp *c);
int c_seek_files(t_data *s, t_comp *c, char *current_word);
int c_parser(t_comp *c, char *path, char *name);
int c_sizing(t_comp *c);

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/23 10:35:44 by gwojda #+# #+# */
/* Updated: 2017/03/10 17:40:40 by gwojda ### ########.fr */
/* Updated: 2017/03/14 11:09:04 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
@ -131,6 +131,7 @@ void ft_clear_window(void);
void free_history_list(t_list_history *head);
int ft_nb_of_line(char *str, size_t pos);
int ft_get_size_prev(char *str, size_t pos);
void sigwinch_resize(int sig);
char *ft_read_stdin(void);
void ft_end(void);

View file

@ -6,7 +6,7 @@
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/09 13:31:21 by alao #+# #+# */
/* Updated: 2017/03/10 17:38:37 by gwojda ### ########.fr */
/* Updated: 2017/03/14 12:09:36 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
@ -70,10 +70,10 @@ static char *c_slicer(t_comp *c)
i--;
tmp[i] == '/' ? i++ : (0);
rt = (i == (int)ft_strlen(tmp) - 1) ? NULL : ft_strsub(tmp, 0, i);
if (c_chevron(c))
/* if (c_chevron(c))
c->match = ft_strdup("");
else
c->match = ft_strsub(tmp, i, ft_strlen(tmp) - i);
c->match = ft_strsub(tmp, i, ft_strlen(tmp) - i);*/
tmp ? ft_memdel((void *)&tmp) : (0);
return (rt);
}
@ -82,7 +82,7 @@ static char *c_slicer(t_comp *c)
** Files searching
*/
int c_seek_files(t_data *s, t_comp *c)
int c_seek_files(t_data *s, t_comp *c, char *current_word)
{
char *path;
@ -95,6 +95,7 @@ int c_seek_files(t_data *s, t_comp *c)
if (c->cpath == NULL)
{
path = c_slicer(c);
c->match = ft_strdup(current_word);
c->cpath = path_solver(c, path, NULL);
path ? ft_memdel((void *)&path) : (0);
}

View file

@ -6,7 +6,7 @@
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/10/15 13:27:14 by alao #+# #+# */
/* Updated: 2017/03/10 17:20:20 by gwojda ### ########.fr */
/* Updated: 2017/03/14 12:12:23 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
@ -54,6 +54,7 @@ static char *c_current_words(t_comp *c)
--pos;
if (c->rcmd[pos] == ' ')
++pos;
DG("rcmd = \"%s\"", c->rcmd);
return (c->rcmd + pos);
}
@ -69,7 +70,7 @@ int c_matching(t_data *s, t_comp *c)
else if (c->rcmd[0] != '.' && !(ft_strchr(c->rcmd, ' ')) && !c_chevron(c))
c_seek_binary(s, c);
else
c_seek_files(s, c);
c_seek_files(s, c, current_word);
if (s->comp && s->comp->lst)
{
c_sizing(c);

View file

@ -6,7 +6,7 @@
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/01/09 13:52:07 by alao #+# #+# */
/* Updated: 2017/03/09 16:47:31 by gwojda ### ########.fr */
/* Updated: 2017/03/14 11:37:25 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
@ -45,7 +45,8 @@ static int c_storing(t_comp *c, char *value, unsigned char type)
{
t_clst *tmp;
if (ft_strncmp(".", value, 1) == 0 || ft_strncmp("..", value, 2) == 0)
if (!(c->match && ft_strncmp(".", c->match, 1) == 0) &&
(ft_strncmp(".", value, 1) == 0 || ft_strncmp("..", value, 2) == 0))
return (0);
if (c->match && ft_strnequ(c->match, value, ft_strlen(c->match)) != 1)
return (0);

View file

@ -6,7 +6,7 @@
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/10/11 10:44:40 by alao #+# #+# */
/* Updated: 2017/03/10 16:07:36 by gwojda ### ########.fr */
/* Updated: 2017/03/14 10:51:14 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
@ -46,7 +46,7 @@ void c_term_mv_back(t_comp *c)
int value;
i = 0;
if (c->c_sy > c->win_y)
if (c->c_line > c->win_y)
value = c->m_size;
else
value = c->c_line;
@ -77,7 +77,7 @@ void c_term_mv_down(t_comp *c)
int value;
i = 0;
if (c->c_sy > c->win_y)
if (c->c_line > c->win_y)
value = c->m_size;
else
value = c->c_line;
@ -88,7 +88,7 @@ void c_term_mv_down(t_comp *c)
i++;
}
i = 0;
if (c->c_sy > c->win_y)
if (c->c_line > c->win_y)
value = c->m_size - 1;
else
value = c->c_line - 1;

View file

@ -6,7 +6,7 @@
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/09/20 14:50:33 by alao #+# #+# */
/* Updated: 2017/03/10 17:20:04 by gwojda ### ########.fr */
/* Updated: 2017/03/14 11:22:04 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
@ -36,7 +36,7 @@ static void c_next_item(t_comp *c)
** of the cursor is restored.
*/
static int c_dispatcher(t_data *s)
int c_dispatcher(t_data *s)
{
if (s->comp && s->comp->lst == NULL)
{

View file

@ -6,7 +6,7 @@
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/02/14 11:27:03 by gwojda #+# #+# */
/* Updated: 2017/03/13 14:30:48 by jhalford ### ########.fr */
/* Updated: 2017/03/14 09:50:57 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -3,10 +3,10 @@
/* ::: :::::::: */
/* sigttou_handler.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/10 15:14:53 by jhalford #+# #+# */
/* Updated: 2017/01/08 13:24:21 by jhalford ### ########.fr */
/* Updated: 2017/03/14 10:55:49 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */

View file

@ -3,10 +3,10 @@
/* ::: :::::::: */
/* shell_init.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/12/12 17:23:59 by jhalford #+# #+# */
/* Updated: 2017/03/11 14:08:30 by jhalford ### ########.fr */
/* Updated: 2017/03/14 11:09:31 by gwojda ### ########.fr */
/* */
/* ************************************************************************** */
@ -35,6 +35,7 @@ void shell_init(int ac, char **av)
signal(SIGTTIN, SIG_IGN);
signal(SIGTTOU, SIG_IGN);
signal(SIGCHLD, SIG_DFL);
signal(SIGWINCH, sigwinch_resize);
*shell_pgid = getpid();
if (setpgid(*shell_pgid, *shell_pgid))
{