minimodem: handle SIGINT on --rx: close the sa backend and print stats

This commit is contained in:
Kamal Mostafa 2012-10-02 14:22:38 -07:00
parent 9627669b24
commit 761cf00b16
1 changed files with 16 additions and 0 deletions

View File

@ -258,6 +258,15 @@ benchmarks()
}
static int rx_stop = 0;
void
rx_stop_sighandler( int sig )
{
rx_stop = 1;
}
void
version()
{
@ -810,8 +819,13 @@ main( int argc, char*argv[] )
float track_amplitude = 0.0;
signal(SIGINT, rx_stop_sighandler);
while ( 1 ) {
if ( rx_stop )
break;
debug_log("advance=%u\n", advance);
/* Shift the samples in samplebuf by 'advance' samples */
@ -1148,6 +1162,8 @@ main( int argc, char*argv[] )
} /* end of the main loop */
signal(SIGINT, SIG_DFL);
if ( carrier ) {
if ( !quiet_mode )
report_no_carrier(fskp, sample_rate, bfsk_data_rate,