diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/htsopt.h | 3 | ||||
-rw-r--r-- | src/httrack.c | 40 |
2 files changed, 12 insertions, 31 deletions
diff --git a/src/htsopt.h b/src/htsopt.h index 6990226..b5e0212 100644 --- a/src/htsopt.h +++ b/src/htsopt.h @@ -358,6 +358,7 @@ struct httrackp { int quiet; // poser des questions autres que wizard? int keyboard; // vérifier stdin int bypass_limits; // bypass built-in limits + int background_on_suspend; // background process on suspend signal // int is_update; // c'est une update (afficher "File updated...") int dir_topindex; // reconstruire top index par la suite @@ -368,8 +369,6 @@ struct httrackp { htslibhandles libHandles; // htsoptstate state; // state - // - int background_on_suspend; // Background process on suspend signal. }; // stats for httrack diff --git a/src/httrack.c b/src/httrack.c index 52a92e7..45c37c4 100644 --- a/src/httrack.c +++ b/src/httrack.c @@ -163,26 +163,7 @@ static int use_show; static httrackp *global_opt = NULL; static void signal_handlers(void); -static void signal_handlers2(void); - -int background_on_suspend = 0 ; - /* - * Leave at 0, if you want Normal Unix behaviour - * of Suspend signal suspending a process. - * Set to 1, if you want the old httrack behaviour - * (at 3.45.3) - * of dropping process into background. ******************* - * Dropping to background may pain, eg jhs@@berklix.com noted: - * Httrack sucked the performance out of my (jhs@@berklix.com) - * DSL coms link even with httrack rate limiting enabled. - * Browsers timed out, I could not temporarily suspend long - * runnning httrack processes, to let browsers recover & - * humans to get some urgent work done. (There were also - * sometimes eg 2 httracks, 1 on each of 2 internal hosts, - * both sucking different parts of the net, through 1 common - * busy gateway, & although both rate limited, browsers still - * timed out. - */ +static void signal_restore_ctl_z(void); int main(int argc, char **argv) { int ret = 0; @@ -207,10 +188,14 @@ int main(int argc, char **argv) { #endif signal_handlers(); - // signal_handlers2(); // This must move to somewhere later after parameters get parsed. 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); @@ -235,8 +220,6 @@ int main(int argc, char **argv) { CHAIN_FUNCTION(opt, sendhead, htsshow_sendheader, NULL); CHAIN_FUNCTION(opt, receivehead, htsshow_receiveheader, NULL); - signal_handlers2(); // JJLATER guess around here maybe good ? - ret = hts_main2(argc, argv, opt); if (ret) { fprintf(stderr, "* %s\n", hts_errmsg(opt)); @@ -729,8 +712,8 @@ 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); + // Background the process. + signal(code, sig_ignore); sig_doback(0); } static void sig_ask( int code ) { // demander @@ -820,7 +803,7 @@ static void signal_handlers(void) { #if 0 /* BUG366763 */ signal( SIGHUP , sig_back ); // close window #endif - // if (background_on_suspend) signal( SIGTSTP , sig_back ); // ^Z Moved to signal_handlers2() + signal( SIGTSTP , sig_back ); // ^Z signal( SIGTERM , sig_finish ); // kill <process> #if 0 /* BUG366763 */ signal( SIGINT , sig_ask ); // ^C @@ -832,10 +815,9 @@ static void signal_handlers(void) { #endif } -static void signal_handlers2(void) { +static void signal_restore_ctl_z(void) { #ifdef _WIN32 -#else - if (background_on_suspend) signal( SIGTSTP , sig_back ); // ^Z + signal( SIGTSTP , SIG_DFL); // ^Z #endif } |