summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorsalad <fmoenne-@student.le-101.fr>2020-08-26 18:44:24 +0200
committersalad <fmoenne-@student.le-101.fr>2020-08-26 18:44:24 +0200
commitad1f44c7ff032c3b20d493805e544cd70ed4bb89 (patch)
treeef5b2f5408646ec27e0503a69057c8ba6b8aff3b /src
parenthandlesigw (diff)
download42-minishell-ad1f44c7ff032c3b20d493805e544cd70ed4bb89.tar.gz
42-minishell-ad1f44c7ff032c3b20d493805e544cd70ed4bb89.tar.bz2
42-minishell-ad1f44c7ff032c3b20d493805e544cd70ed4bb89.tar.xz
42-minishell-ad1f44c7ff032c3b20d493805e544cd70ed4bb89.tar.zst
42-minishell-ad1f44c7ff032c3b20d493805e544cd70ed4bb89.zip
s**** f*****
Diffstat (limited to '')
-rw-r--r--src/b_cd.c2
-rw-r--r--src/c_init.c32
-rw-r--r--src/c_init.h19
-rw-r--r--src/m_loop.c6
-rw-r--r--src/s_init.c2
-rw-r--r--src/u_utils.c9
-rw-r--r--src/u_utils.h3
7 files changed, 59 insertions, 14 deletions
diff --git a/src/b_cd.c b/src/b_cd.c
index e322ef8..40fbc1a 100644
--- a/src/b_cd.c
+++ b/src/b_cd.c
@@ -13,7 +13,7 @@
#include <libft.h>
#include <stdint.h>
#include <unistd.h>
-#include <limits.h>
+#include <linux/limits.h>
#include "b_export_next.h"
#include "f_fail.h"
diff --git a/src/c_init.c b/src/c_init.c
new file mode 100644
index 0000000..5cf46f3
--- /dev/null
+++ b/src/c_init.c
@@ -0,0 +1,32 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* u_init.c :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/02/14 17:19:27 by rbousset #+# #+# */
+/* Updated: 2020/02/14 17:19:29 by rbousset ### ########lyon.fr */
+/* */
+/* ************************************************************************** */
+
+#include <term.h>
+#include <curses.h>
+
+void u_handle_sigwinch(int dummy_signal)
+{
+ (void)dummy_signal;
+ tputs(LC, 1, ft_putchar);
+ fflush(stdout);
+}
+
+int16_t c_init_tcaps(void)
+{
+ char *bp;
+ char *term;
+ char *LC;
+
+ term = getenv("TERM");
+ tgetent(bp, term);
+ LC = tgetstr("lc", &term);
+}
diff --git a/src/c_init.h b/src/c_init.h
new file mode 100644
index 0000000..da3d549
--- /dev/null
+++ b/src/c_init.h
@@ -0,0 +1,19 @@
+/* ************************************************************************** */
+/* */
+/* ::: :::::::: */
+/* u_init.h :+: :+: :+: */
+/* +:+ +:+ +:+ */
+/* By: rbousset <marvin@42.fr> +#+ +:+ +#+ */
+/* +#+#+#+#+#+ +#+ */
+/* Created: 2020/02/14 17:19:27 by rbousset #+# #+# */
+/* Updated: 2020/02/14 17:19:29 by rbousset ### ########lyon.fr */
+/* */
+/* ************************************************************************** */
+
+#ifndef U_INIT_H
+#define U_INIT_H
+
+int c_init_tcaps(void);
+void u_handle_sigwinch(int dummy_signal);
+
+#endif
diff --git a/src/m_loop.c b/src/m_loop.c
index 86d641f..ed92fd5 100644
--- a/src/m_loop.c
+++ b/src/m_loop.c
@@ -14,13 +14,14 @@
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
+#include <signal.h>
#include "e_line.h"
#include "m_loop_next.h"
#include "m_prompt.h"
#include "p_line.h"
#include "s_line.h"
-#include "u_utils.h"
+#include "c_init.h"
static void
m_parse_and_run_line(char *line, t_msh *msh)
@@ -37,7 +38,8 @@ uint8_t
char *line;
int8_t gnl;
- signal(SIGWINCH, u_handle_sigwinch);
+ c_init_tcaps();
+ signal(SIGWINCH, u_handle_sigwinch);
gnl = 1;
while (gnl > 0)
{
diff --git a/src/s_init.c b/src/s_init.c
index 7b36653..7f4c6b9 100644
--- a/src/s_init.c
+++ b/src/s_init.c
@@ -14,7 +14,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <unistd.h>
-#include <limits.h>
+#include <linux/limits.h>
#include <dirent.h>
#include <errno.h>
diff --git a/src/u_utils.c b/src/u_utils.c
index b4ef987..745b79c 100644
--- a/src/u_utils.c
+++ b/src/u_utils.c
@@ -15,6 +15,8 @@
#include <stdint.h>
#include <unistd.h>
#include <signal.h>
+#include <term.h>
+#include <curses.h>
#include "f_fail.h"
#include "s_struct.h"
@@ -66,10 +68,3 @@ 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 020da83..6362e14 100644
--- a/src/u_utils.h
+++ b/src/u_utils.h
@@ -14,12 +14,9 @@
#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