deleted terminal.c
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2021/10/08 02:59:58 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);
|
int init(t_all *c);
|
||||||
char *init_prompt(char *prompt_base);
|
char *init_prompt(char *prompt_base);
|
||||||
char **retrieve_path(void);
|
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);
|
void set_signals_behaviour(void);
|
||||||
|
|
||||||
// Shell modes
|
// Shell modes
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2021/10/08 02:35:52 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_base;
|
||||||
char *prompt;
|
char *prompt;
|
||||||
t_token *token_list;
|
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;
|
} t_all;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2021/10/10 23:53:17 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(environ);
|
||||||
ft_free_2d_arr(c->path);
|
ft_free_2d_arr(c->path);
|
||||||
free_pipeline(&c->pipeline);
|
free_pipeline(&c->pipeline);
|
||||||
//if (c->termios_changed)
|
|
||||||
// tcsetattr(STDIN_FILENO, TCSANOW, &c->ori_termios);
|
|
||||||
rl_clear_history();
|
rl_clear_history();
|
||||||
close_stdio();
|
close_stdio();
|
||||||
exit(exit_status);
|
exit(exit_status);
|
||||||
|
|||||||
@@ -1,76 +0,0 @@
|
|||||||
/* ************************************************************************** */
|
|
||||||
/* */
|
|
||||||
/* ::: :::::::: */
|
|
||||||
/* terminal.c :+: :+: :+: */
|
|
||||||
/* +:+ +:+ +:+ */
|
|
||||||
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
|
||||||
/* +#+#+#+#+#+ +#+ */
|
|
||||||
/* 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 <yourtype>'.\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); */
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user