diff options
author | salad <fmoenne-@student.le-101.fr> | 2020-08-26 16:49:29 +0200 |
---|---|---|
committer | salad <fmoenne-@student.le-101.fr> | 2020-08-26 16:49:29 +0200 |
commit | aa89d8488ef0ec021505bee68d6ee5060191cfc1 (patch) | |
tree | 2cc940f21ea42beea65106f3ad85fe8d8f9c96b6 /src | |
parent | TODO update (diff) | |
download | 42-minishell-aa89d8488ef0ec021505bee68d6ee5060191cfc1.tar.gz 42-minishell-aa89d8488ef0ec021505bee68d6ee5060191cfc1.tar.bz2 42-minishell-aa89d8488ef0ec021505bee68d6ee5060191cfc1.tar.xz 42-minishell-aa89d8488ef0ec021505bee68d6ee5060191cfc1.tar.zst 42-minishell-aa89d8488ef0ec021505bee68d6ee5060191cfc1.zip |
handlesigw
Diffstat (limited to '')
-rw-r--r-- | src/m_loop.c | 2 | ||||
-rw-r--r-- | src/u_utils.c | 8 | ||||
-rw-r--r-- | src/u_utils.h | 3 |
3 files changed, 13 insertions, 0 deletions
diff --git a/src/m_loop.c b/src/m_loop.c index e174f30..86d641f 100644 --- a/src/m_loop.c +++ b/src/m_loop.c @@ -20,6 +20,7 @@ #include "m_prompt.h" #include "p_line.h" #include "s_line.h" +#include "u_utils.h" static void m_parse_and_run_line(char *line, t_msh *msh) @@ -36,6 +37,7 @@ uint8_t char *line; int8_t gnl; + signal(SIGWINCH, u_handle_sigwinch); gnl = 1; while (gnl > 0) { diff --git a/src/u_utils.c b/src/u_utils.c index f50d861..b4ef987 100644 --- a/src/u_utils.c +++ b/src/u_utils.c @@ -14,6 +14,7 @@ #include <stdlib.h> #include <stdint.h> #include <unistd.h> +#include <signal.h> #include "f_fail.h" #include "s_struct.h" @@ -65,3 +66,10 @@ uint64_t } return (argc); } + +int u_handle_sigwinch(int dummy_signal) +{ + term = getenv(); + tputs(, 1, ft_putchar); + fflush(stdout); +} diff --git a/src/u_utils.h b/src/u_utils.h index 6362e14..020da83 100644 --- a/src/u_utils.h +++ b/src/u_utils.h @@ -14,9 +14,12 @@ #define U_UTILS_H #include <stdint.h> +#include <term.h> +#include <curses.h> void u_eof_stdin(void); uint64_t u_builtins_get_argc(const char *args[]); char **u_get_env_var_names(t_msh *msh); +int u_handle_sigwinch(int dummy_signal); #endif |