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

Go to the source code of this file.

Functions

void signal_reset_prompt (int signo, siginfo_t *info, void *ucontext)
 
void set_signals_interactive (t_ms_data *data)
 
void signal_print_newline (int signal)
 
void sigquit_ignore (void)
 
void set_signals_noninteractive (void)
 

Function Documentation

◆ set_signals_interactive()

void set_signals_interactive ( t_ms_data data)

Definition at line 43 of file signals.c.

44{
45 struct sigaction sa;
46
47 (void)data;
48 sa.sa_sigaction = signal_reset_prompt;
49 sa.sa_flags = SA_RESTART | SA_SIGINFO;
50 sigemptyset(&sa.sa_mask);
51 sigaction(SIGINT, &sa, NULL);
52}
void signal_reset_prompt(int signo, siginfo_t *info, void *ucontext)
Definition signals.c:54

References signal_reset_prompt().

Referenced by main_loop().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_signals_noninteractive()

void set_signals_noninteractive ( void  )

Definition at line 66 of file signals.c.

67{
68 struct sigaction sa;
69
70 sa.sa_handler = SIG_IGN;
71 sigemptyset(&sa.sa_mask);
72 sa.sa_flags = 0;
73 sigaction(SIGQUIT, &sa, NULL);
74}

Referenced by main_loop().

Here is the caller graph for this function:

◆ signal_print_newline()

void signal_print_newline ( int  signal)

Definition at line 26 of file signals.c.

27{
28 (void)signal;
29 write(STDOUT_FILENO, "\n", 1);
30 rl_on_new_line();
31}

◆ signal_reset_prompt()

void signal_reset_prompt ( int  signo,
siginfo_t *  info,
void *  ucontext 
)

Definition at line 54 of file signals.c.

55{
56 (void)signo;
57 (void)info;
58 (void)ucontext;
59 write(STDOUT_FILENO, "\n", 1);
60 rl_on_new_line();
61 rl_replace_line("", 0);
63 rl_redisplay();
64}
int is_external_command_running(void)

References is_external_command_running().

Referenced by set_signals_interactive().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sigquit_ignore()

void sigquit_ignore ( void  )

Definition at line 33 of file signals.c.

34{
35 struct sigaction a;
36
37 sigemptyset(&a.sa_mask);
38 a.sa_flags = 0;
39 a.sa_handler = SIG_IGN;
40 sigaction(SIGQUIT, &a, NULL);
41}