-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignals.c
46 lines (41 loc) · 1.36 KB
/
signals.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* signals.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: qcesar <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/13 16:19:37 by heveline #+# #+# */
/* Updated: 2021/11/16 21:28:00 by qcesar ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
void handlerint(int signal)
{
signal = 0;
rl_on_new_line();
rl_redisplay();
write(1, " \b\b\n", 5);
rl_on_new_line();
rl_replace_line("", 0);
rl_redisplay();
set_exit(1);
}
void sighandler(void)
{
signal(SIGQUIT, SIG_IGN);
signal(SIGINT, handlerint);
}
void handlerintproc(int signum)
{
(void)signum;
set_exit(130);
printf("\n");
rl_on_new_line();
}
void sigproc(void)
{
signal(SIGINT, SIG_IGN);
signal(SIGQUIT, handlerquit);
signal(SIGINT, handlerintproc);
}