fix: heredoc work without global
This commit is contained in:
@ -6,26 +6,25 @@
|
||||
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/03/28 15:59:01 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/04/17 10:39:36 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/04/17 11:23:21 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "signal_private.h"
|
||||
|
||||
void ft_ctrlc_heredoc(int num)
|
||||
{
|
||||
close(0);
|
||||
ft_putchar_fd('\n', 1);
|
||||
(void) num;
|
||||
}
|
||||
|
||||
void ft_ctrlc(int num)
|
||||
{
|
||||
if (*ft_get_heredoc() != -1)
|
||||
{
|
||||
close(*ft_get_heredoc());
|
||||
*ft_get_heredoc() = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
rl_replace_line("", 0);
|
||||
rl_on_new_line();
|
||||
ft_putchar_fd('\n', 1);
|
||||
rl_redisplay();
|
||||
}
|
||||
rl_replace_line("", 0);
|
||||
rl_on_new_line();
|
||||
ft_putchar_fd('\n', 1);
|
||||
rl_redisplay();
|
||||
*ft_get_exit_code() = 130;
|
||||
(void) num;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/03/28 16:02:31 by cchauvet #+# #+# */
|
||||
/* Updated: 2023/03/28 16:03:11 by cchauvet ### ########.fr */
|
||||
/* Updated: 2023/04/17 11:14:28 by cchauvet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -15,5 +15,6 @@
|
||||
|
||||
void ft_quit(int num);
|
||||
void ft_ctrlc(int num);
|
||||
void ft_ctrlc_heredoc(int num);
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user