diff --git a/headers/minishell_prototypes.h b/headers/minishell_prototypes.h index 8e5fb94..b9d2944 100644 --- a/headers/minishell_prototypes.h +++ b/headers/minishell_prototypes.h @@ -6,7 +6,7 @@ /* By: lperrey +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/10/08 02:59:58 by lperrey #+# #+# */ -/* Updated: 2021/12/16 04:50:31 by lperrey ### ########.fr */ +/* Updated: 2021/12/16 06:35:04 by lperrey ### ########.fr */ /* */ /* ************************************************************************** */ @@ -20,9 +20,6 @@ extern char **environ; int init(t_all *c); char *init_prompt(char *prompt_base); char **retrieve_path(void); -int set_terminal_attributes(struct termios *ori_termios, - struct termios *interactive_termios, - int *termios_changed); // WIP, TEST, TEMP, PLACEHOLDER, NOT IMPORTANT, :) void set_signals_behaviour(void); // Shell modes diff --git a/headers/minishell_structs.h b/headers/minishell_structs.h index 69b5f79..8fe4e6b 100644 --- a/headers/minishell_structs.h +++ b/headers/minishell_structs.h @@ -6,7 +6,7 @@ /* By: lperrey +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/10/08 02:35:52 by lperrey #+# #+# */ -/* Updated: 2021/12/01 16:49:37 by lperrey ### ########.fr */ +/* Updated: 2021/12/16 06:34:29 by lperrey ### ########.fr */ /* */ /* ************************************************************************** */ @@ -42,11 +42,6 @@ typedef struct s_all char *prompt_base; char *prompt; t_token *token_list; -// struct termios ori_termios; -// struct termios interactive_termios; -// int termios_changed; -// struct sigaction ori_signal_behaviour; -// struct sigaction signal_behaviour; } t_all; #endif diff --git a/srcs/misc/free.c b/srcs/misc/free.c index 303a182..0e8c95b 100644 --- a/srcs/misc/free.c +++ b/srcs/misc/free.c @@ -6,7 +6,7 @@ /* By: lperrey +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/10/10 23:53:17 by lperrey #+# #+# */ -/* Updated: 2021/12/02 00:42:33 by lperrey ### ########.fr */ +/* Updated: 2021/12/16 06:35:03 by lperrey ### ########.fr */ /* */ /* ************************************************************************** */ @@ -20,8 +20,6 @@ int exit_free(t_all *c, int exit_status) ft_free_2d_arr(environ); ft_free_2d_arr(c->path); free_pipeline(&c->pipeline); - //if (c->termios_changed) - // tcsetattr(STDIN_FILENO, TCSANOW, &c->ori_termios); rl_clear_history(); close_stdio(); exit(exit_status); diff --git a/srcs/misc/terminal.c b/srcs/misc/terminal.c deleted file mode 100644 index b33f969..0000000 --- a/srcs/misc/terminal.c +++ /dev/null @@ -1,76 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* terminal.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: lperrey +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2021/10/27 00:10:04 by lperrey #+# #+# */ -/* Updated: 2021/10/30 14:17:16 by lperrey ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "minishell.h" - -#define CTRL_C 03 -#define CTRL_D 04 -#define CTRL_BACKSLASH 034 - -int set_terminal_attributes(struct termios *ori_termios, - struct termios *interactive_termios, - int *termios_changed) -{ - tcgetattr(STDIN_FILENO, ori_termios); - *interactive_termios = *ori_termios; - - interactive_termios->c_cc[VINTR] = CTRL_D; - interactive_termios->c_cc[VEOF] = CTRL_C; - - //interactive_termios->c_cc[VQUIT] = CTRL_C; - //interactive_termios->c_cc[VEOF] = CTRL_BACKSLASH; - - //interactive_termios->c_cc[VEOL] = CTRL_C; - - *termios_changed = 1; - tcsetattr(STDIN_FILENO, TCSANOW, interactive_termios); - - return (1); -} - - //printf("STDIN_FILENO = %s\n ", ttyname(STDIN_FILENO)); - //printf("STDOUT_FILENO = %s\n ", ttyname(STDOUT_FILENO)); - //printf("STDERR_FILENO = %s\n ", ttyname(STDERR_FILENO)); - //ft_putendl_fd(ttyname(STDIN_FILENO), 1); - //ft_putendl_fd(ttyname(STDOUT_FILENO), 1); - //ft_putendl_fd(ttyname(STDERR_FILENO), 1); - // ft_printf("BEFORE\n"); - // ft_printf("i_io.c_cc[VEOF] = %i\ni_termios.c_cc[VINTR] = %i\n", (*interactive_termios)->c_cc[VEOF], (*interactive_termios)->c_cc[VINTR]); - // ft_printf("o_io.c_cc[VEOF] = %i\no_termios.c_cc[VINTR] = %i\n", (*ori_termios)->c_cc[VEOF], (*ori_termios)->c_cc[VINTR]); - // ft_printf("AFTER\n"); - // ft_printf("i_io.c_cc[VEOF] = %i\ni_termios.c_cc[VINTR] = %i\n", (*interactive_termios)->c_cc[VEOF], (*interactive_termios)->c_cc[VINTR]); - // ft_printf("o_io.c_cc[VEOF] = %i\no_termios.c_cc[VINTR] = %i\n", (*ori_termios)->c_cc[VEOF], (*ori_termios)->c_cc[VINTR]); - -void wip_test() -{ - char term_desc[2048]; - char *term_type; - int term_width; - int term_height; - int ret; - - term_type = getenv("TERM"); - if (term_type == 0) - ft_putstr_fd("Specify a terminal type with `setenv TERM '.\n", 2); - ret = tgetent(term_desc, term_type); - if (ret < 0) - ft_putstr_fd("Could not access the termcap data base.\n", 2); - if (ret == 0) - ft_putstr_fd("Terminal type `%s' is not defined.\n", 2); - term_height = tgetnum ("li"); - term_width = tgetnum ("co"); - /* Extract information that termcap functions use. */ -/* temp = tgetstr ("pc", BUFFADDR); - PC = temp ? *temp : 0; - BC = tgetstr ("le", BUFFADDR); - UP = tgetstr ("up", BUFFADDR); */ -}