~nloomans/ft_select

1339fc35b2c805638a33bd85e218632180caaa52 — Noah Loomans 1 year, 8 months ago 2571843
make handle_suspend more cross-platform

The suspend signal technically doesn't need to be fired using CTRL+Z.
It could be bound to any key. Use tcgetattr to find the right key.
1 files changed, 4 insertions(+), 1 deletions(-)

M src/event.c
M src/event.c => src/event.c +4 -1
@@ 20,10 20,13 @@ static void						handle_generic(int signum);

static void						handle_suspend(int signum)
{
	struct termios attr;

	(void)signum;
	terminal_configure(TERMINAL_CONFIGURE_RESTORE);
	signal(SIGTSTP, SIG_DFL);
	ioctl(STDIN_FILENO, TIOCSTI, "\032");
	tcgetattr(STDIN_FILENO, &attr);
	ioctl(STDIN_FILENO, TIOCSTI, (char []){attr.c_cc[VSUSP], '\0'});
}

static void						handle_continue(int signum)