/*
* Copyright (C) 1984-2023 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
*
* For more information, see the README file.
*/
/*
* Routines dealing with signals.
*
* A signal usually merely causes a bit to be set in the "signals" word.
* At some convenient time, the mainline code checks to see if any
* signals need processing by calling psignal().
* If we happen to be reading from a file [in iread()] at the time
* the signal is received, we call intread to interrupt the iread.
*/
#include "less.h"
#include <signal.h>
/*
* "sigs" contains bits indicating signals which need to be processed.
*/
public int sigs;
extern int sc_width, sc_height;
extern int screen_trashed;
extern int lnloop;
extern int linenums;
extern int wscroll;
extern int reading;
extern int quit_on_intr;
extern int secure;
extern long jump_sline_fraction;
/*
* Interrupt signal handler.
*/
#if MSDOS_COMPILER!=WIN32C
/* ARGSUSED*/
static RETSIGTYPE u_interrupt(int type)
{
bell();
#if OS2
LSIGNAL(SIGINT, SIG_ACK);
#endif
LSIGNAL(SIGINT, u_interrupt);
sigs |= S_INTERRUPT;
#if MSDOS_COMPILER==DJGPPC
/*
* If a keyboard has been hit, it must be Ctrl-C
* (as opposed to Ctrl-Break), so consume it.
* (Otherwise, Less will beep when it sees Ctrl-C from keyboard.)
*/
if (kbhit())
getkey();
#endif
#if HILITE_SEARCH
set_filter_pattern(NULL, 0);
#endif
if (reading)
intread(); /* May longjmp */
}
#endif