-/* $OpenBSD: cl.h,v 1.11 2021/09/01 14:28:15 schwarze Exp $ */
+/* $OpenBSD: cl.h,v 1.12 2021/09/02 11:19:02 schwarze Exp $ */
/*-
* Copyright (c) 1993, 1994
* @(#)cl.h 10.19 (Berkeley) 9/24/96
*/
-extern volatile sig_atomic_t cl_sighup;
extern volatile sig_atomic_t cl_sigint;
extern volatile sig_atomic_t cl_sigterm;
extern volatile sig_atomic_t cl_sigwinch;
char *rmso, *smso; /* Inverse video terminal strings. */
char *smcup, *rmcup; /* Terminal start/stop strings. */
- int killersig; /* Killer signal. */
#define INDX_HUP 0
#define INDX_INT 1
#define INDX_TERM 2
-/* $OpenBSD: cl_funcs.c,v 1.21 2021/09/01 14:28:15 schwarze Exp $ */
+/* $OpenBSD: cl_funcs.c,v 1.22 2021/09/02 11:19:02 schwarze Exp $ */
/*-
* Copyright (c) 1993, 1994
* If we received a killer signal, we're done, there's no point
* in refreshing the screen.
*/
- if (clp->killersig)
+ if (cl_sigterm)
return (0);
/*
* unchanged. In addition, the terminal has already been reset
* correctly, so leave it alone.
*/
- if (clp->killersig) {
+ if (cl_sigterm) {
F_CLR(clp, CL_SCR_EX_INIT | CL_SCR_VI_INIT);
return (0);
}
-/* $OpenBSD: cl_main.c,v 1.34 2021/09/01 14:28:15 schwarze Exp $ */
+/* $OpenBSD: cl_main.c,v 1.35 2021/09/02 11:19:02 schwarze Exp $ */
/*-
* Copyright (c) 1993, 1994
GS *__global_list; /* GLOBAL: List of screens. */
-volatile sig_atomic_t cl_sighup;
volatile sig_atomic_t cl_sigint;
volatile sig_atomic_t cl_sigterm;
volatile sig_atomic_t cl_sigwinch;
}
/* If a killer signal arrived, pretend we just got it. */
- if (clp->killersig) {
- (void)signal(clp->killersig, SIG_DFL);
- (void)kill(getpid(), clp->killersig);
+ if (cl_sigterm) {
+ (void)signal(cl_sigterm, SIG_DFL);
+ (void)kill(getpid(), cl_sigterm);
/* NOTREACHED */
}
}
}
-#define GLOBAL_CLP \
- CL_PRIVATE *clp = GCLP(__global_list);
-static void
-h_hup(int signo)
-{
- GLOBAL_CLP;
-
- cl_sighup = 1;
- clp->killersig = SIGHUP;
-}
-
static void
h_int(int signo)
{
static void
h_term(int signo)
{
- GLOBAL_CLP;
-
- cl_sigterm = 1;
- clp->killersig = SIGTERM;
+ cl_sigterm = signo;
}
static void
{
cl_sigwinch = 1;
}
-#undef GLOBAL_CLP
/*
* sig_init --
clp = GCLP(gp);
- cl_sighup = 0;
cl_sigint = 0;
cl_sigterm = 0;
cl_sigwinch = 0;
if (sp == NULL) {
- if (setsig(SIGHUP, &clp->oact[INDX_HUP], h_hup) ||
+ if (setsig(SIGHUP, &clp->oact[INDX_HUP], h_term) ||
setsig(SIGINT, &clp->oact[INDX_INT], h_int) ||
setsig(SIGTERM, &clp->oact[INDX_TERM], h_term) ||
setsig(SIGWINCH, &clp->oact[INDX_WINCH], h_winch)
)
err(1, NULL);
} else
- if (setsig(SIGHUP, NULL, h_hup) ||
+ if (setsig(SIGHUP, NULL, h_term) ||
setsig(SIGINT, NULL, h_int) ||
setsig(SIGTERM, NULL, h_term) ||
setsig(SIGWINCH, NULL, h_winch)