mirror of
https://github.com/rkd77/elinks.git
synced 2024-11-04 08:17:17 -05:00
[ctrl_z] Added code links-based for ctrl-z and fg. Refs #65
This commit is contained in:
parent
2a16aa91fe
commit
62419b1054
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "main/main.h"
|
#include "main/main.h"
|
||||||
#include "main/select.h"
|
#include "main/select.h"
|
||||||
|
#include "main/timer.h"
|
||||||
#include "main/version.h"
|
#include "main/version.h"
|
||||||
#include "osdep/signals.h"
|
#include "osdep/signals.h"
|
||||||
#include "terminal/kbd.h"
|
#include "terminal/kbd.h"
|
||||||
@ -63,16 +64,21 @@ sig_ign(void *x)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void poll_fg(void *);
|
||||||
|
static struct timer *fg_poll_timer = NULL;
|
||||||
|
|
||||||
#if defined(SIGTSTP) || defined(SIGTTIN)
|
#if defined(SIGTSTP) || defined(SIGTTIN)
|
||||||
static void
|
static void
|
||||||
sig_tstp(struct terminal *term)
|
sig_tstp(struct terminal *term)
|
||||||
{
|
{
|
||||||
#ifdef SIGSTOP
|
#ifdef SIGSTOP
|
||||||
|
pid_t newpid;
|
||||||
pid_t pid = getpid();
|
pid_t pid = getpid();
|
||||||
|
|
||||||
block_itrm();
|
block_itrm();
|
||||||
#if defined (SIGCONT) && defined(SIGTTOU)
|
#if defined (SIGCONT) && defined(SIGTTOU)
|
||||||
if (!fork()) {
|
newpid = fork();
|
||||||
|
if (!newpid) {
|
||||||
sleep(1);
|
sleep(1);
|
||||||
kill(pid, SIGCONT);
|
kill(pid, SIGCONT);
|
||||||
/* Use _exit() rather than exit(), so that atexit
|
/* Use _exit() rather than exit(), so that atexit
|
||||||
@ -85,9 +91,33 @@ sig_tstp(struct terminal *term)
|
|||||||
#endif
|
#endif
|
||||||
raise(SIGSTOP);
|
raise(SIGSTOP);
|
||||||
#endif
|
#endif
|
||||||
|
if (fg_poll_timer != NULL) kill_timer(&fg_poll_timer);
|
||||||
|
install_timer(&fg_poll_timer, FG_POLL_TIME, poll_fg, term);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void
|
||||||
|
poll_fg(void *t_)
|
||||||
|
{
|
||||||
|
struct terminal *t = (struct terminal *)t_;
|
||||||
|
int r ;
|
||||||
|
|
||||||
|
fg_poll_timer = NULL;
|
||||||
|
r = unblock_itrm();
|
||||||
|
if (r == -1) {
|
||||||
|
install_timer(&fg_poll_timer, FG_POLL_TIME, poll_fg, t);
|
||||||
|
}
|
||||||
|
#if 0
|
||||||
|
if (r == -2) {
|
||||||
|
/* This will unblock externally spawned viewer, if it exists */
|
||||||
|
#ifdef SIGCONT
|
||||||
|
EINTRLOOP(r, kill(0, SIGCONT));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef SIGCONT
|
#ifdef SIGCONT
|
||||||
static void
|
static void
|
||||||
sig_cont(struct terminal *term)
|
sig_cont(struct terminal *term)
|
||||||
|
@ -115,4 +115,6 @@
|
|||||||
* to fit in the screen, with this much extra space. Try 4. */
|
* to fit in the screen, with this much extra space. Try 4. */
|
||||||
#define TABLE_LINE_PADDING -1
|
#define TABLE_LINE_PADDING -1
|
||||||
|
|
||||||
|
#define FG_POLL_TIME 500
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user