maxishell
Implementation of a shell for Linux-like systems
Loading...
Searching...
No Matches
signals_utils.c File Reference
#include "signals.h"
#include <readline/readline.h>
#include <readline/history.h>
#include <unistd.h>
#include "libft.h"
#include <sys/wait.h>
Include dependency graph for signals_utils.c:

Go to the source code of this file.

Functions

t_signal_contextget_context (t_ms_data *data)
 
void handle_sigint_heredoc (int signo)
 
int is_external_command_running (void)
 

Function Documentation

◆ get_context()

t_signal_context * get_context ( t_ms_data data)

Definition at line 21 of file signals_utils.c.

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}
t_ms_data * data_cxt
Definition signals.h:24

References s_signal_context::data_cxt.

Referenced by free_signal_context().

Here is the caller graph for this function:

◆ handle_sigint_heredoc()

void handle_sigint_heredoc ( int  signo)

Definition at line 38 of file signals_utils.c.

39{
40 (void)signo;
42}
volatile sig_atomic_t g_heredoc_interrupted

References g_heredoc_interrupted.

Referenced by setup_sigint_handler().

Here is the caller graph for this function:

◆ is_external_command_running()

int is_external_command_running ( void  )

Definition at line 44 of file signals_utils.c.

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}

Referenced by signal_reset_prompt().

Here is the caller graph for this function: