File src/signal_handler.c changed (mode: 100644) (index 5c1b7f4..39c6165) |
... |
... |
handle_window_resize(int signum) |
43 |
43 |
signal(SIGWINCH, handle_window_resize); |
signal(SIGWINCH, handle_window_resize); |
44 |
44 |
} |
} |
45 |
45 |
|
|
|
46 |
|
void |
|
47 |
|
handle_suspend(int signum) |
|
48 |
|
{ |
|
49 |
|
if (!isendwin()) { |
|
50 |
|
curs_set(1); |
|
51 |
|
endwin(); |
|
52 |
|
} |
|
53 |
|
fprintf(stderr, "\n"); |
|
54 |
|
signal(SIGTSTP, handle_suspend); |
|
55 |
|
kill(0, SIGSTOP); |
|
56 |
|
} |
|
57 |
|
|
|
58 |
|
void |
|
59 |
|
handle_resume(int signum) |
|
60 |
|
{ |
|
61 |
|
if (isendwin()) { |
|
62 |
|
refresh(); |
|
63 |
|
curs_set(0); |
|
64 |
|
} |
|
65 |
|
ungetch(keys.refresh_1); |
|
66 |
|
signal(SIGCONT, handle_resume); |
|
67 |
|
} |
|
68 |
|
|
46 |
69 |
void |
void |
47 |
70 |
signal_handler() |
signal_handler() |
48 |
71 |
{ |
{ |
|
... |
... |
signal_handler() |
52 |
75 |
signal(SIGTERM, handle_crash); /* handle soft kill */ |
signal(SIGTERM, handle_crash); /* handle soft kill */ |
53 |
76 |
signal(SIGSEGV, handle_crash); /* handle seg. fault */ |
signal(SIGSEGV, handle_crash); /* handle seg. fault */ |
54 |
77 |
signal(SIGHUP, handle_crash); /* handle hup signal */ |
signal(SIGHUP, handle_crash); /* handle hup signal */ |
|
78 |
|
signal(SIGTSTP, handle_suspend);/* handle terminal suspend */ |
|
79 |
|
signal(SIGCONT, handle_resume); /* handle back from suspend */ |
55 |
80 |
#ifdef SIGWINCH |
#ifdef SIGWINCH |
56 |
81 |
signal(SIGWINCH, handle_window_resize); |
signal(SIGWINCH, handle_window_resize); |
57 |
82 |
#endif |
#endif |
File src/utils.c changed (mode: 100644) (index 1801b7a..8da99a4) |
... |
... |
pinfo_getch() |
376 |
376 |
void |
void |
377 |
377 |
waitforgetch() |
waitforgetch() |
378 |
378 |
{ |
{ |
|
379 |
|
int ret; |
|
380 |
|
|
379 |
381 |
fd_set rdfs; |
fd_set rdfs; |
380 |
382 |
FD_ZERO(&rdfs); |
FD_ZERO(&rdfs); |
381 |
383 |
FD_SET(0, &rdfs); |
FD_SET(0, &rdfs); |
382 |
|
select(1, &rdfs, NULL, NULL, NULL); |
|
|
384 |
|
|
|
385 |
|
/* we might get interrupted by e.g. SIGTSTP/SIGCONT */ |
|
386 |
|
do ret = select(1, &rdfs, NULL, NULL, NULL); |
|
387 |
|
while (ret == -1 && errno == EINTR); |
383 |
388 |
} |
} |
384 |
389 |
|
|
385 |
390 |
/* returns 0 on success, 1 on error */ |
/* returns 0 on success, 1 on error */ |