Changeset View
Changeset View
Standalone View
Standalone View
contrib/less/signal.c
Show All 36 Lines | |||||
extern int less_is_more; | extern int less_is_more; | ||||
extern long jump_sline_fraction; | extern long jump_sline_fraction; | ||||
/* | /* | ||||
* Interrupt signal handler. | * Interrupt signal handler. | ||||
*/ | */ | ||||
/* ARGSUSED*/ | /* ARGSUSED*/ | ||||
static RETSIGTYPE | static RETSIGTYPE | ||||
u_interrupt(type) | u_interrupt(int type) | ||||
int type; | |||||
{ | { | ||||
bell(); | bell(); | ||||
#if OS2 | #if OS2 | ||||
LSIGNAL(SIGINT, SIG_ACK); | LSIGNAL(SIGINT, SIG_ACK); | ||||
#endif | #endif | ||||
LSIGNAL(SIGINT, u_interrupt); | LSIGNAL(SIGINT, u_interrupt); | ||||
sigs |= S_INTERRUPT; | sigs |= S_INTERRUPT; | ||||
#if MSDOS_COMPILER==DJGPPC | #if MSDOS_COMPILER==DJGPPC | ||||
Show All 12 Lines | |||||
} | } | ||||
#ifdef SIGTSTP | #ifdef SIGTSTP | ||||
/* | /* | ||||
* "Stop" (^Z) signal handler. | * "Stop" (^Z) signal handler. | ||||
*/ | */ | ||||
/* ARGSUSED*/ | /* ARGSUSED*/ | ||||
static RETSIGTYPE | static RETSIGTYPE | ||||
stop(type) | stop(int type) | ||||
int type; | |||||
{ | { | ||||
LSIGNAL(SIGTSTP, stop); | LSIGNAL(SIGTSTP, stop); | ||||
sigs |= S_STOP; | sigs |= S_STOP; | ||||
if (reading) | if (reading) | ||||
intread(); | intread(); | ||||
} | } | ||||
#endif | #endif | ||||
#ifdef SIGWINCH | #ifdef SIGWINCH | ||||
/* | /* | ||||
* "Window" change handler | * "Window" change handler | ||||
*/ | */ | ||||
/* ARGSUSED*/ | /* ARGSUSED*/ | ||||
public RETSIGTYPE | public RETSIGTYPE | ||||
winch(type) | winch(int type) | ||||
int type; | |||||
{ | { | ||||
LSIGNAL(SIGWINCH, winch); | LSIGNAL(SIGWINCH, winch); | ||||
sigs |= S_WINCH; | sigs |= S_WINCH; | ||||
if (reading) | if (reading) | ||||
intread(); | intread(); | ||||
} | } | ||||
#else | #else | ||||
#ifdef SIGWIND | #ifdef SIGWIND | ||||
/* | /* | ||||
* "Window" change handler | * "Window" change handler | ||||
*/ | */ | ||||
/* ARGSUSED*/ | /* ARGSUSED*/ | ||||
public RETSIGTYPE | public RETSIGTYPE | ||||
winch(type) | winch(int type) | ||||
int type; | |||||
{ | { | ||||
LSIGNAL(SIGWIND, winch); | LSIGNAL(SIGWIND, winch); | ||||
sigs |= S_WINCH; | sigs |= S_WINCH; | ||||
if (reading) | if (reading) | ||||
intread(); | intread(); | ||||
} | } | ||||
#endif | #endif | ||||
#endif | #endif | ||||
#if MSDOS_COMPILER==WIN32C | #if MSDOS_COMPILER==WIN32C | ||||
/* | /* | ||||
* Handle CTRL-C and CTRL-BREAK keys. | * Handle CTRL-C and CTRL-BREAK keys. | ||||
*/ | */ | ||||
#include "windows.h" | #include "windows.h" | ||||
static BOOL WINAPI | static BOOL WINAPI | ||||
wbreak_handler(dwCtrlType) | wbreak_handler(DWORD dwCtrlType) | ||||
DWORD dwCtrlType; | |||||
{ | { | ||||
switch (dwCtrlType) | switch (dwCtrlType) | ||||
{ | { | ||||
case CTRL_C_EVENT: | case CTRL_C_EVENT: | ||||
case CTRL_BREAK_EVENT: | case CTRL_BREAK_EVENT: | ||||
sigs |= S_INTERRUPT; | sigs |= S_INTERRUPT; | ||||
return (TRUE); | return (TRUE); | ||||
default: | default: | ||||
break; | break; | ||||
} | } | ||||
return (FALSE); | return (FALSE); | ||||
} | } | ||||
#endif | #endif | ||||
/* | /* | ||||
* Set up the signal handlers. | * Set up the signal handlers. | ||||
*/ | */ | ||||
public void | public void | ||||
init_signals(on) | init_signals(int on) | ||||
int on; | |||||
{ | { | ||||
if (on) | if (on) | ||||
{ | { | ||||
/* | /* | ||||
* Set signal handlers. | * Set signal handlers. | ||||
*/ | */ | ||||
(void) LSIGNAL(SIGINT, u_interrupt); | (void) LSIGNAL(SIGINT, u_interrupt); | ||||
#if MSDOS_COMPILER==WIN32C | #if MSDOS_COMPILER==WIN32C | ||||
Show All 35 Lines | #endif | ||||
} | } | ||||
} | } | ||||
/* | /* | ||||
* Process any signals we have received. | * Process any signals we have received. | ||||
* A received signal cause a bit to be set in "sigs". | * A received signal cause a bit to be set in "sigs". | ||||
*/ | */ | ||||
public void | public void | ||||
psignals() | psignals(void) | ||||
{ | { | ||||
register int tsignals; | int tsignals; | ||||
if ((tsignals = sigs) == 0) | if ((tsignals = sigs) == 0) | ||||
return; | return; | ||||
sigs = 0; | sigs = 0; | ||||
#ifdef SIGTSTP | #ifdef SIGTSTP | ||||
if (tsignals & S_STOP) | if (tsignals & S_STOP) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines |