summaryrefslogtreecommitdiffstats
path: root/src/c_init.c
diff options
context:
space:
mode:
authorsalad <fmoenne-@student.le-101.fr>2020-09-09 15:57:14 +0200
committersalad <fmoenne-@student.le-101.fr>2020-09-09 15:57:14 +0200
commit1c5c7fb2cda9fbc9ea4a6240adbcafed81764c6f (patch)
tree6bdff3e3184ddbe42c058905bf70091daa2034c4 /src/c_init.c
parentinsert a char try it (diff)
download42-minishell-1c5c7fb2cda9fbc9ea4a6240adbcafed81764c6f.tar.gz
42-minishell-1c5c7fb2cda9fbc9ea4a6240adbcafed81764c6f.tar.bz2
42-minishell-1c5c7fb2cda9fbc9ea4a6240adbcafed81764c6f.tar.xz
42-minishell-1c5c7fb2cda9fbc9ea4a6240adbcafed81764c6f.tar.zst
42-minishell-1c5c7fb2cda9fbc9ea4a6240adbcafed81764c6f.zip
LITERALLY C89
Diffstat (limited to '')
-rw-r--r--src/c_init.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/c_init.c b/src/c_init.c
index effcc7d..18482c1 100644
--- a/src/c_init.c
+++ b/src/c_init.c
@@ -9,6 +9,9 @@
/* Updated: 2020/02/14 17:19:29 by rbousset ### ########lyon.fr */
/* */
/* ************************************************************************** */
+# define FT_KEY_LEFT (char[4]){ 27, 91, 68, 0 }
+# define FT_KEY_RIGHT (char[4]){ 27, 91, 67, 0 }
+
#include <unistd.h>
#include <termios.h>
@@ -110,9 +113,11 @@ int16_t
}
else
{
- if (strncmp(buf, tgetstr("kr", NULL), ft_strlen(tgetstr("kr", NULL))) == 0)
+ /* if (strncmp(buf, tgetstr("kr", NULL), ft_strlen(tgetstr("kr", NULL))) == 0) */
+ /* if ((*((unsigned int*)buf)) == FT_KEY_RIGHT) */
+ if (strncmp(buf, FT_KEY_LEFT, 4) == 0)
{
- return (c_key_right(ft_strlen(line), tcaps));
+ return (c_key_left(ft_strlen(line), tcaps));
}
else if (buf[0] == '\n')
{