diff --git a/42sh/Makefile b/42sh/Makefile index e8a964d8..9fe8f1ca 100644 --- a/42sh/Makefile +++ b/42sh/Makefile @@ -6,7 +6,7 @@ # By: wescande +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2016/08/29 21:32:58 by wescande #+# #+# # -# Updated: 2017/02/17 17:16:16 by wescande ### ########.fr # +# Updated: 2017/03/04 17:27:41 by gwojda ### ########.fr # # # # **************************************************************************** # @@ -190,7 +190,7 @@ lexer/token_free.c\ lexer/token_init.c\ lexer/token_print.c\ line-editing/completion.c\ -line-editing/control_c_and_d.c\ +line-editing/control_features.c\ line-editing/copy_cut_paste.c\ line-editing/ft_prompt.c\ line-editing/get_key.c\ diff --git a/42sh/includes/ft_readline.h b/42sh/includes/ft_readline.h index 06b7f449..5945fdef 100644 --- a/42sh/includes/ft_readline.h +++ b/42sh/includes/ft_readline.h @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/23 10:35:44 by gwojda #+# #+# */ -/* Updated: 2017/02/16 12:44:23 by gwojda ### ########.fr */ +/* Updated: 2017/03/05 19:37:38 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -37,6 +37,7 @@ # define TOUCHE_DELETE 2117294875 # define TOUCHE_CTRL_C 3 # define TOUCHE_CTRL_D 4 +# define TOUCHE_CTRL_L 12 # define TOUCHE_CTRL_R 18 # define TOUCHE_SUPPR 127 # define TOUCHE_HOME 4741915 @@ -52,20 +53,6 @@ # define TOUCHE_F5 892427035 # define TOUCHE_F6 925981467 -/* # define PROMPT_QUOTES "quote> " */ -/* # define PROMPT_DQUOTES "dquote> " */ -/* # define PROMPT_BQUOTES "bquote> " */ -/* # define PROMPT_ACCOLADE "cursh> " */ -/* # define PROMPT_BRACKET "subsh> " */ -/* # define PROMPT_BSLASH "> " */ - -/* # define SIZE_PROMPT_QUOTES 7 */ -/* # define SIZE_PROMPT_DQUOTES 8 */ -/* # define SIZE_PROMPT_BQUOTES 8 */ -/* # define SIZE_PROMPT_ACCOLADE 7 */ -/* # define SIZE_PROMPT_BRACKET 7 */ -/* # define SIZE_PROMPT_BSLASH 2 */ - # define IS_QUOTES (1 << 0) # define IS_BQUOTES (1 << 1) # define IS_DQUOTES (1 << 2) @@ -106,22 +93,7 @@ typedef struct s_key void (*f)(void); } t_key; -typedef struct s_prompt_type -{ - char key; - int value; - char *new_prompt; -} t_prompt_type; - -typedef struct s_brackets -{ - int pos; - char tabl[100]; -} t_brackets; - extern t_key g_keys[]; -extern t_prompt_type g_prompt_tab[]; -extern t_brackets g_brackets; void ft_reset_tab(char *tabl); void ft_putnc(char c, int n); @@ -152,6 +124,7 @@ char *ft_strget_history(char *str); int ft_nb_last_line(char *str, size_t pos); int ft_put(int nb); void ft_check_line(void); +void ft_clear_window(void); char *ft_read_stdin(void); void ft_end(void); @@ -163,6 +136,7 @@ void ft_down(void); void ft_buff_f6(void); void ft_control_d(void); void ft_control_c(void); +void ft_control_l(void); void ft_del(void); void ft_suppr(void); void ft_print(int ret); diff --git a/42sh/libft b/42sh/libft index 8f6e64fa..bfc8ca20 160000 --- a/42sh/libft +++ b/42sh/libft @@ -1 +1 @@ -Subproject commit 8f6e64fa9b4ac1dd3e3d5200fb93471ddfeedd40 +Subproject commit bfc8ca207ab4d39f0140322c0f1d368137304a3c diff --git a/42sh/src/history/add_str_in_history.c b/42sh/src/history/add_str_in_history.c index a0b37c4a..fb4e636f 100644 --- a/42sh/src/history/add_str_in_history.c +++ b/42sh/src/history/add_str_in_history.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/14 11:27:03 by gwojda #+# #+# */ -/* Updated: 2017/02/16 12:37:35 by gwojda ### ########.fr */ +/* Updated: 2017/03/04 15:52:19 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ diff --git a/42sh/src/line-editing/control_c_and_d.c b/42sh/src/line-editing/control_features.c similarity index 84% rename from 42sh/src/line-editing/control_c_and_d.c rename to 42sh/src/line-editing/control_features.c index d484cbaa..cfc57840 100644 --- a/42sh/src/line-editing/control_c_and_d.c +++ b/42sh/src/line-editing/control_features.c @@ -1,12 +1,12 @@ /* ************************************************************************** */ /* */ /* ::: :::::::: */ -/* control_c_and_d.c :+: :+: :+: */ +/* control_features.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/02 15:17:28 by gwojda #+# #+# */ -/* Updated: 2017/02/14 14:08:21 by gwojda ### ########.fr */ +/* Updated: 2017/03/05 19:36:56 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -41,3 +41,11 @@ void ft_control_c(void) ft_strdel(&STR); POS = 0; } + +void ft_control_l(void) +{ + ft_clear_window(); + ft_prompt(); + ft_strdel(&STR); + POS = 0; +} diff --git a/42sh/src/line-editing/get_key.c b/42sh/src/line-editing/get_key.c index 30444e59..03e45b7c 100644 --- a/42sh/src/line-editing/get_key.c +++ b/42sh/src/line-editing/get_key.c @@ -6,7 +6,7 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2016/12/19 16:28:49 by gwojda #+# #+# */ -/* Updated: 2017/02/14 11:16:09 by gwojda ### ########.fr */ +/* Updated: 2017/03/05 19:38:09 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ @@ -19,6 +19,7 @@ t_key g_key[] = {FLECHE_GAUCHE , &ft_move_left }, {FLECHE_DROITE , &ft_move_right }, {TOUCHE_DELETE , &ft_del }, + {TOUCHE_CTRL_L , &ft_control_l }, {TOUCHE_CTRL_C , &ft_control_c }, {TOUCHE_CTRL_D , &ft_control_d }, {TOUCHE_CTRL_R , &ft_surch_in_history }, diff --git a/42sh/src/line-editing/lib_line_editing/tool_line_2.c b/42sh/src/line-editing/lib_line_editing/tool_line_2.c index 6753278a..55777404 100644 --- a/42sh/src/line-editing/lib_line_editing/tool_line_2.c +++ b/42sh/src/line-editing/lib_line_editing/tool_line_2.c @@ -6,13 +6,13 @@ /* By: gwojda +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/20 19:07:52 by gwojda #+# #+# */ -/* Updated: 2017/02/05 17:06:07 by gwojda ### ########.fr */ +/* Updated: 2017/03/05 19:36:44 by gwojda ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" -static void ft_clear_window(void) +void ft_clear_window(void) { pid_t soon_pid; char *tab_str[2]; diff --git a/42sh/test b/42sh/test new file mode 100644 index 00000000..9054a36f --- /dev/null +++ b/42sh/test @@ -0,0 +1,3 @@ + shell_init.c 28 interactive shell settings + token_print.c 29 13:[ls] + token_print.c 29 13:[ls] diff --git a/42sh/testmake b/42sh/testmake new file mode 100644 index 00000000..b8ed3f2a --- /dev/null +++ b/42sh/testmake @@ -0,0 +1,65 @@ + shell_init.c 28 interactive shell settings + token_print.c 29 13:[ls] + token_print.c 29 13:[if] + token_print.c 29 13:[ls] + token_print.c 29 13:[if ls +] + token_print.c 29 13:[if ls +then pwd +] + token_print.c 29 13:[if ls +then pwd +Elif ls +] + token_print.c 29 13:[if ls +then pwd +Elif ls +Then pwd +] + token_print.c 29 13:[if ls +then pwd +Elif ls +Then pwd +Elif ls +] + token_print.c 29 13:[if ls +then pwd +Elif ls +Then pwd +Elif ls +then pwd +] + token_print.c 29 13:[if ls +then pwd +Elif ls +Then pwd +Elif ls +then pwd +fi +] + token_print.c 29 13:[if ls +then pwd +Elif ls +Then pwd +Elif ls +then pwd +fi +] + token_print.c 29 13:[if ls +then pwd +Elif ls +Then pwd +Elif ls +then pwd +fi + +] + token_print.c 29 13:[if ls +then pwd +Elif ls +Then pwd +Elif ls +then pwd +fi + +]