diff options
author | Xavier Roche <xroche@users.noreply.github.com> | 2012-05-01 19:44:50 +0000 |
---|---|---|
committer | Xavier Roche <xroche@users.noreply.github.com> | 2012-05-01 19:44:50 +0000 |
commit | 9112768bbe353ee50c0414a4260b1219d3064b57 (patch) | |
tree | 095bf3e56c6df9d86b3117e37bb30750b3cfce16 /src/httrack.c | |
parent | 2593388359e464d7d265b511b86e97ff179250c8 (diff) |
Fixed background_on_suspend
Diffstat (limited to 'src/httrack.c')
-rw-r--r-- | src/httrack.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/httrack.c b/src/httrack.c index c989299..ef34f44 100644 --- a/src/httrack.c +++ b/src/httrack.c @@ -191,11 +191,6 @@ int main(int argc, char **argv) { hts_init(); opt = global_opt = hts_create_opt(); - // Julian H. Stacey: ability to have a real ^Z - if (!opt->background_on_suspend) { - signal_restore_ctl_z(); - } - CHAIN_FUNCTION(opt, init, htsshow_init, NULL); CHAIN_FUNCTION(opt, uninit, htsshow_uninit, NULL); CHAIN_FUNCTION(opt, start, htsshow_start, NULL); @@ -712,9 +707,15 @@ static void sig_ask( int code ) { // demander #else static void sig_doback(int blind); static void sig_back( int code ) { // ignorer et mettre en backing - // Background the process. - signal(code, sig_ignore); - sig_doback(0); + if (global_opt != NULL && !global_opt->background_on_suspend) { + signal( SIGTSTP , SIG_DFL); // ^Z + printf("\nInterrupting the program.\n"); fflush(stdout); + kill(getpid(), SIGTSTP); + } else { + // Background the process. + signal(code, sig_ignore); + sig_doback(0); + } } static void sig_ask( int code ) { // demander char s[256]; |