--- ab.c-missing_html_output-4 2008-07-07 16:28:12.000000000 +0200 +++ ab.c-html_sigs-5 2008-07-07 16:32:24.000000000 +0200 @@ -996,9 +996,14 @@ /* calculate and output results in HTML */ -static void output_html_results(void) +static void output_html_results(int sig) { - double timetaken = (double) (lasttime - start) / APR_USEC_PER_SEC; + double timetaken; + + if (sig) { + lasttime = apr_time_now(); /* record final time if interrupted */ + } + timetaken = (double) (lasttime - start) / APR_USEC_PER_SEC; printf("\n\n\n", tablestring); printf("" @@ -1151,6 +1156,9 @@ } printf("
Server Software:
\n"); } + if (sig) { + exit(1); + } } /* --------------------------------------------------------- */ @@ -1694,7 +1702,10 @@ #ifdef SIGINT /* Output the results if the user terminates the run early. */ - apr_signal(SIGINT, output_results); + if (use_html) + apr_signal(SIGINT, output_html_results); + else + apr_signal(SIGINT, output_results); #endif /* initialise lots of requests */ @@ -1816,7 +1827,7 @@ printf("..done\n"); if (use_html) - output_html_results(); + output_html_results(0); else output_results(0); }