diff options
Diffstat (limited to 'src/c_ctrls.c')
-rw-r--r-- | src/c_ctrls.c | 60 |
1 files changed, 35 insertions, 25 deletions
diff --git a/src/c_ctrls.c b/src/c_ctrls.c index dce9db6..dae91a2 100644 --- a/src/c_ctrls.c +++ b/src/c_ctrls.c @@ -21,47 +21,57 @@ t_msh *c_get_msh(int mode, t_msh *src) { - static t_msh *msh; + static t_msh *msh; - if (mode == 1) - { - msh = src; - } - return (msh); + if (mode == 1) + { + msh = src; + } + return (msh); } short c_ctrl_l(char *line, t_caps *tcaps, t_msh *msh) { - tputs(tgetstr("cl", NULL), 1, ft_putchar); - m_prompt_psx(1, msh); - c_redraw_line(line, tcaps, msh); - return (1); + tputs(tgetstr("cl", NULL), 1, ft_putchar); + m_prompt_psx(1, msh); + c_redraw_line(line, tcaps, msh); + return (1); } char *c_ctrl_c(char **line, char *buf, t_msh *msh) { - msh->ret = 130; - buf[0] = '\n'; - write(1, "\n", 1); - ft_memdel((void**)line); - return (ft_strdup("\0")); + msh->ret = 130; + buf[0] = '\n'; + write(1, "\n", 1); + ft_memdel((void**)line); + return (ft_strdup("\0")); } void c_signal_int(int signo) { - t_msh *msh; + static t_msh *msh; - msh = NULL; - signal(SIGINT, c_signal_int); - (void)signo; - msh = c_get_msh(0, msh); - ioctl(1, TIOCSTI, "\002"); - msh->ret = 130; + msh = NULL; + signal(SIGINT, c_signal_int); + (void)signo; + write(1, "\n", 1); + msh = c_get_msh(0, msh); + msh->sig = 130; + ioctl(1, TIOCSTI, "\002"); } void c_signal_ign(int signo) { - signal(SIGINT, c_signal_int); - (void)signo; - signal(SIGTSTP, SIG_IGN); + t_msh *msh; + + msh = NULL; + if (signo == 3) + { + write(1, "\n", 1); + msh = c_get_msh(0, msh); + msh->sig = 131; + } + signal(SIGINT, c_signal_int); + (void)signo; + signal(SIGTSTP, SIG_IGN); } |