-
Notifications
You must be signed in to change notification settings - Fork 0
/
signals.c
51 lines (47 loc) · 1.38 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
47
48
49
50
51
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* signals.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sstyr <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/01/16 20:05:40 by sstyr #+# #+# */
/* Updated: 2022/01/16 20:05:43 by sstyr ### ########.fr */
/* */
/* ************************************************************************** */
#include "includes/parser.h"
void sig_int(int signal)
{
if (signal == SIGINT)
{
printf("\n");
rl_on_new_line();
rl_replace_line("", 1);
rl_redisplay();
g_exit_status = 1;
}
}
void here_sig(int signal)
{
if (signal == SIGINT)
{
(void)signal;
g_exit_status = 1;
exit(1);
}
}
void child_sig(int signal)
{
if (signal == SIGINT)
{
(void)signal;
write(1, "\n", 1);
g_exit_status = 130;
}
else if (signal == SIGQUIT)
{
(void)signal;
write(2, "Quit: 3\n", 8);
g_exit_status = 131;
}
}