http://www.berklix.com/~jhs/src/bsd/fixes/FreeBSD/ports/gen/www/httrack/files/ patch-jc.httrack-3.46.1.REL=9.1-RELEASE.cust_rel by jhs@@berklix.com See also incorrect: patch-jc.httrack-3.46.1.REL=9.1-RELEASE.not.no_customise No need to patch src/htscoremain.c case 'y' *** src/httrack.c.orig Sat Jun 23 11:10:34 2012 --- src/httrack.c Tue Apr 2 18:03:13 2013 *************** *** 165,170 **** --- 165,189 ---- static void signal_handlers(void); static void signal_restore_ctl_z(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. + */ + int main(int argc, char **argv) { int ret = 0; httrackp *opt; *** src/httrack.c.o Mon Jan 27 18:02:16 2014 --- src/httrack.c Mon Jan 27 18:03:45 2014 *************** *** 234,239 **** --- 234,242 ---- CHAIN_FUNCTION(opt, sendhead, htsshow_sendheader, NULL); CHAIN_FUNCTION(opt, receivehead, htsshow_receiveheader, NULL); + signal_restore_ctl_z(); // This must be after parameters get parsed. + // (But I do not know this code to know if that's now.) + ret = hts_main2(argc, argv, opt); if (ret) { fprintf(stderr, "* %s\n", hts_errmsg(opt)); *** src/httrack.c.o Mon Jan 27 18:05:08 2014 --- src/httrack.c Mon Jan 27 18:05:54 2014 *************** *** 729,734 **** --- 729,735 ---- #else static void sig_doback(int blind); static void sig_back( int code ) { // ignorer et mettre en backing + // Ignore and Background the process. if (global_opt != NULL && !global_opt->background_on_suspend) { signal( SIGTSTP , SIG_DFL); // ^Z printf("\nInterrupting the program.\n"); fflush(stdout); *** src/httrack.c.o Mon Jan 27 18:06:21 2014 --- src/httrack.c Mon Jan 27 18:07:54 2014 *************** *** 827,833 **** #if 0 /* BUG366763 */ signal( SIGHUP , sig_back ); // close window #endif ! signal( SIGTSTP , sig_back ); // ^Z signal( SIGTERM , sig_finish ); // kill #if 0 /* BUG366763 */ signal( SIGINT , sig_ask ); // ^C --- 827,836 ---- #if 0 /* BUG366763 */ signal( SIGHUP , sig_back ); // close window #endif ! // Original author has next line uncommented, ! // but that is Not Unix standard. ! // Principle of least suprise requires this Off by default. ! // signal( SIGTSTP , sig_back ); // ^Z signal( SIGTERM , sig_finish ); // kill #if 0 /* BUG366763 */ signal( SIGINT , sig_ask ); // ^C # *** src/httrack.c.orig Mon Jan 27 22:26:34 2014 # --- src/httrack.c Mon Jan 27 22:27:40 2014 # *************** # *** 218,223 **** # --- 218,228 ---- # * timed out. # */ # # + static void signal_restore_ctl_z(void) { # + #ifndef _WIN32 # + if (background_on_suspend) signal( SIGTSTP , sig_back ); // ^Z # + #endif # + # int main(int argc, char **argv) { # int ret = 0; # httrackp *opt; # Change from Xaviers default On to Off !!! # - otherwise it # defaults to both capture & background on ^Z, which is not # consistent with Unix expectations, & a Pain # when one wants to temporarily suspend an httrack that is sucking the # net link dry & get some decent # interactive net performance for a human for a while, before letting # httrack resume hoging most of bandwidth again later. *** src/htslib.c.orig Sat Jun 23 11:10:34 2012 --- src/htslib.c Mon Jan 27 17:54:33 2014 *************** *** 5272,5278 **** opt->makeindex=1; // faire un index opt->kindex=0; // index 'keyword' opt->delete_old=1; // effacer anciens fichiers ! opt->background_on_suspend=1; // Background the process if Control Z calls signal suspend. opt->makestat=0; // pas de fichier de stats opt->maketrack=0; // ni de tracking opt->timeout=120; // timeout par défaut (2 minutes) --- 5272,5278 ---- opt->makeindex=1; // faire un index opt->kindex=0; // index 'keyword' opt->delete_old=1; // effacer anciens fichiers ! opt->background_on_suspend=0; // Background the process if Control Z calls signal suspend. opt->makestat=0; // pas de fichier de stats opt->maketrack=0; // ni de tracking opt->timeout=120; // timeout par défaut (2 minutes)