summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Makefile3
-rw-r--r--libft/Makefile2
-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
9 files changed, 62 insertions, 16 deletions
diff --git a/Makefile b/Makefile
index 29f8d96..0524861 100644
--- a/Makefile
+++ b/Makefile
@@ -25,6 +25,7 @@ SRCS_NAME += b_export_mute
SRCS_NAME += b_pwd
SRCS_NAME += b_type
SRCS_NAME += b_unset
+SRCS_NAME += c_init
SRCS_NAME += e_builtins
SRCS_NAME += e_externs
SRCS_NAME += e_externs_next
@@ -86,7 +87,7 @@ ifeq (${OS}, FreeBSD)
CC = /usr/bin/cc
endif
ifeq (${OS}, Linux)
-CC = /usr/bin/clang-9
+CC = clang
endif
ifeq (${OS}, Darwin)
CC = clang
diff --git a/libft/Makefile b/libft/Makefile
index 6ada2e1..4e5095b 100644
--- a/libft/Makefile
+++ b/libft/Makefile
@@ -128,7 +128,7 @@ ifeq (${OS}, FreeBSD)
CC = /usr/bin/cc
endif
ifeq (${OS}, Linux)
-CC = /usr/bin/clang-9
+CC = clang
endif
ifeq (${OS}, Darwin)
CC = clang
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