summaryrefslogtreecommitdiffstats
path: root/src/c_input.c
diff options
context:
space:
mode:
authorsalad <fmoenne-@student.le-101.fr>2020-11-06 20:17:34 +0100
committersalad <fmoenne-@student.le-101.fr>2020-11-06 20:17:34 +0100
commit87a70e527eca58cad87c14fd2a8595b8bce85e25 (patch)
tree9bbb931a9bdd16d93f6546e1e7f254ba3c3db221 /src/c_input.c
parentC-c arrows (diff)
download42-minishell-87a70e527eca58cad87c14fd2a8595b8bce85e25.tar.gz
42-minishell-87a70e527eca58cad87c14fd2a8595b8bce85e25.tar.bz2
42-minishell-87a70e527eca58cad87c14fd2a8595b8bce85e25.tar.xz
42-minishell-87a70e527eca58cad87c14fd2a8595b8bce85e25.tar.zst
42-minishell-87a70e527eca58cad87c14fd2a8595b8bce85e25.zip
major changes to ctrlc + c, no norm for now
Diffstat (limited to 'src/c_input.c')
-rw-r--r--src/c_input.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/c_input.c b/src/c_input.c
index 8f15449..5e7e937 100644
--- a/src/c_input.c
+++ b/src/c_input.c
@@ -23,15 +23,32 @@
#include "m_prompt.h"
#include "m_loop.h"
+t_msh
+ *c_get_struct(int mode, t_msh *msh)
+{
+ static t_msh *mstruct = NULL;
+
+ if (mode)
+ {
+ mstruct = msh;
+ }
+ return (mstruct);
+}
void c_signal_int(int signo)
{
+ t_msh *msh;
+
+ msh = NULL;
signal(SIGINT, c_signal_int);
(void)signo;
+ msh = c_get_struct(0, msh);
+ msh->ret = 130;
+ write(1, "qwe", 3);
ioctl(1, TIOCSTI, "\002");
}
-void signal_ign(int signo)
+void c_signal_ign(int signo)
{
signal(SIGINT, c_signal_int);
(void)signo;
@@ -50,7 +67,7 @@ short
return (-1);
c_set_term_raw(1);
signal(SIGINT, c_signal_int);
- signal(SIGQUIT, signal_ign);
+ signal(SIGQUIT, c_signal_ign);
tcaps->cpos = 0;
tcaps->lpos = 0;
tcaps->nlines = 1;