GCC Code Coverage Report


Directory: ./
File: src/signals.c
Date: 2024-06-05 00:36:48
Exec Total Coverage
Lines: 3 16 18.8%
Functions: 1 3 33.3%
Branches: 1 6 16.7%

Line Branch Exec Source
1 /*
2 ** EPITECH PROJECT, 2024
3 ** 42sh
4 ** File description:
5 ** The file containing the signals functions
6 */
7 /**
8 * @file signals.c
9 * @brief The file containing the signals functions
10 */
11
12 #include "../include/myshell.h"
13
14 /**
15 * @brief Display the signal returned by executing a command
16 * @param signal The signal
17 * @return <b>void</b>
18 */
19 376 void status_handler(int status)
20 {
21
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 376 times.
376 if (WIFSIGNALED(status)) {
22 if (WTERMSIG(status) == 8)
23 my_putstr("Floating exception");
24 else
25 my_putstr(strsignal(WTERMSIG(status)));
26 if (WCOREDUMP(status))
27 my_putstr(" (core dumped)\n");
28 else
29 my_putstr("\n");
30 }
31 376 }
32
33 /**
34 * @brief Display the prompt when the SIGINT signal is received
35 * @param signal The signal
36 * @return <b>void</b>
37 */
38 void print_line(int signal)
39 {
40 my_putchar('\n');
41 check_tty();
42 }
43
44 /**
45 * @brief Display "exit" when the a CRTL+D is received
46 * @note I disabled it because it didn't work
47 * @param signal The signal
48 * @return <b>void</b>
49 */
50 void print_exit(int signal)
51 {
52 my_putstr("exit\n");
53 }
54