maxishell
Implementation of a shell for Linux-like systems
Loading...
Searching...
No Matches
signals_utils.c
Go to the documentation of this file.
1/* ************************************************************************** */
2/* */
3/* ::: :::::::: */
4/* signals_utils.c :+: :+: :+: */
5/* +:+ +:+ +:+ */
6/* By: rocky <marvin@42.fr> +#+ +:+ +#+ */
7/* +#+#+#+#+#+ +#+ */
8/* Created: 2024/09/06 13:43:47 by rocky #+# #+# */
9/* Updated: 2024/09/06 13:43:49 by rocky ### ########.fr */
10/* */
11/* ************************************************************************** */
12
13#include "signals.h"
14#include <readline/readline.h>
15#include <readline/history.h>
16#include <unistd.h>
17#include "libft.h"
18#include <sys/wait.h>
19
20// Pulls ms_data into sigint handler, bypassing need of second global variable
22{
23 static t_signal_context *context = NULL;
24
25 if (data != NULL)
26 {
27 if (!context)
28 {
29 context = malloc(sizeof(t_signal_context));
30 if (!context)
31 return (NULL);
32 }
33 context->data_cxt = data;
34 }
35 return (context);
36}
37
38void handle_sigint_heredoc(int signo)
39{
40 (void)signo;
42}
43
45{
46 pid_t child_pid;
47
48 child_pid = waitpid(-1, NULL, WNOHANG);
49 if (child_pid == 0)
50 return (1);
51 else
52 return (0);
53}
volatile sig_atomic_t g_heredoc_interrupted
void handle_sigint_heredoc(int signo)
int is_external_command_running(void)
t_signal_context * get_context(t_ms_data *data)
t_ms_data * data_cxt
Definition signals.h:24