completion en cas d'unique possibilité : OK ! :D
This commit is contained in:
parent
c9dc8a5bd2
commit
045b3c0226
8 changed files with 21 additions and 18 deletions
|
|
@ -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/02/03 15:18:41 by alao ### ########.fr #
|
# Updated: 2017/02/03 15:23:50 by gwojda ### ########.fr #
|
||||||
# #
|
# #
|
||||||
# **************************************************************************** #
|
# **************************************************************************** #
|
||||||
|
|
||||||
NAME = 42sh
|
NAME = 42sh
|
||||||
|
|
||||||
CC = gcc
|
CC = gcc
|
||||||
FLAGS = -Wall -Wextra -Werror
|
FLAGS = -Wall -Wextra -Werror -g
|
||||||
D_FLAGS = -g
|
D_FLAGS = -g
|
||||||
|
|
||||||
DELTA = $$(echo "$$(tput cols)-47"|bc)
|
DELTA = $$(echo "$$(tput cols)-47"|bc)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/03 13:10:38 by alao #+# #+# */
|
/* Created: 2017/02/03 13:10:38 by alao #+# #+# */
|
||||||
/* Updated: 2017/02/03 13:52:01 by alao ### ########.fr */
|
/* Updated: 2017/02/03 15:33:53 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -42,7 +42,7 @@ int c_updater(t_comp *c)
|
||||||
DG("Resulting RCMD [%s] with pos [%d] from [%d]", rt, new_pos, c->ircmd);
|
DG("Resulting RCMD [%s] with pos [%d] from [%d]", rt, new_pos, c->ircmd);
|
||||||
rt ? ft_memdel((void *)&rt) : (0);
|
rt ? ft_memdel((void *)&rt) : (0);
|
||||||
c_clear(data_singleton());
|
c_clear(data_singleton());
|
||||||
return (0);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
/* By: alao <alao@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/09/20 14:50:33 by alao #+# #+# */
|
/* Created: 2016/09/20 14:50:33 by alao #+# #+# */
|
||||||
/* Updated: 2017/02/03 14:53:57 by alao ### ########.fr */
|
/* Updated: 2017/02/03 15:39:26 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -135,6 +135,5 @@ int completion(long int keypress)
|
||||||
return (c_gtfo(s->comp, keypress));
|
return (c_gtfo(s->comp, keypress));
|
||||||
}
|
}
|
||||||
test(s->comp);
|
test(s->comp);
|
||||||
c_dispatcher(s);
|
return (c_dispatcher(s));
|
||||||
return (0);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/26 13:32:52 by gwojda #+# #+# */
|
/* Created: 2017/01/26 13:32:52 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/02/03 14:09:20 by gwojda ### ########.fr */
|
/* Updated: 2017/02/03 15:27:37 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -77,6 +77,8 @@ void ft_check_line(void)
|
||||||
i = 0;
|
i = 0;
|
||||||
status = 0;
|
status = 0;
|
||||||
str = data_singleton()->line.input;
|
str = data_singleton()->line.input;
|
||||||
|
if (!str)
|
||||||
|
return ;
|
||||||
while (str[i])
|
while (str[i])
|
||||||
{
|
{
|
||||||
if (IS_BSLASH & status)
|
if (IS_BSLASH & status)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/02/03 14:15:55 by gwojda #+# #+# */
|
/* Created: 2017/02/03 14:15:55 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/02/03 15:17:05 by alao ### ########.fr */
|
/* Updated: 2017/02/03 15:39:40 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -15,8 +15,9 @@
|
||||||
int ft_completion(int ret)
|
int ft_completion(int ret)
|
||||||
{
|
{
|
||||||
size_t tmp;
|
size_t tmp;
|
||||||
|
char boolean;
|
||||||
|
|
||||||
|
boolean = 0;
|
||||||
if ((ret != TOUCHE_TAB && ret != 10)
|
if ((ret != TOUCHE_TAB && ret != 10)
|
||||||
|| (ret == 10 && !(data_singleton()->comp)))
|
|| (ret == 10 && !(data_singleton()->comp)))
|
||||||
return (0);
|
return (0);
|
||||||
|
|
@ -24,8 +25,8 @@ int ft_completion(int ret)
|
||||||
if (ret == 10)
|
if (ret == 10)
|
||||||
ft_puttermcaps("cd");
|
ft_puttermcaps("cd");
|
||||||
if (data_singleton()->comp || ret == TOUCHE_TAB)
|
if (data_singleton()->comp || ret == TOUCHE_TAB)
|
||||||
completion(ret);
|
boolean = completion(ret);
|
||||||
if (ret == 10)
|
if (boolean || ret == 10)
|
||||||
{
|
{
|
||||||
ft_current_str(data_singleton()->line.input, tmp);
|
ft_current_str(data_singleton()->line.input, tmp);
|
||||||
ft_get_next_str(data_singleton()->line.input, &tmp);
|
ft_get_next_str(data_singleton()->line.input, &tmp);
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
/* By: gwojda <gwojda@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/12/19 16:28:49 by gwojda #+# #+# */
|
/* Created: 2016/12/19 16:28:49 by gwojda #+# #+# */
|
||||||
/* Updated: 2017/02/03 15:17:19 by alao ### ########.fr */
|
/* Updated: 2017/02/03 15:24:37 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -49,8 +49,8 @@ char *ft_read_stdin(void)
|
||||||
if (data_singleton()->line.input[data_singleton()->line.pos])
|
if (data_singleton()->line.input[data_singleton()->line.pos])
|
||||||
++(data_singleton()->line.pos);
|
++(data_singleton()->line.pos);
|
||||||
}
|
}
|
||||||
if (data_singleton()->comp)
|
if (data_singleton()->comp)
|
||||||
c_clear(data_singleton());
|
c_clear(data_singleton());
|
||||||
while (42)
|
while (42)
|
||||||
{
|
{
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/28 19:26:32 by jhalford #+# #+# */
|
/* Created: 2016/11/28 19:26:32 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/02/03 13:44:30 by jhalford ### ########.fr */
|
/* Updated: 2017/02/03 15:25:55 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -21,6 +21,7 @@ int data_init(void)
|
||||||
|
|
||||||
data = data_singleton();
|
data = data_singleton();
|
||||||
data->env = ft_sstrdup(environ);
|
data->env = ft_sstrdup(environ);
|
||||||
|
data->comp = NULL;
|
||||||
data->opts = SHELL_OPTS_JOBC;
|
data->opts = SHELL_OPTS_JOBC;
|
||||||
|
|
||||||
data->exec.process.path = NULL;
|
data->exec.process.path = NULL;
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@
|
||||||
/* ::: :::::::: */
|
/* ::: :::::::: */
|
||||||
/* data_singleton.c :+: :+: :+: */
|
/* data_singleton.c :+: :+: :+: */
|
||||||
/* +:+ +:+ +:+ */
|
/* +:+ +:+ +:+ */
|
||||||
/* By: jhalford <jack@crans.org> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2017/01/10 11:36:39 by jhalford #+# #+# */
|
/* Created: 2017/01/10 11:36:39 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/01/10 11:47:11 by jhalford ### ########.fr */
|
/* Updated: 2017/02/03 15:25:13 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue