From 4a6b5827779979873209f887cc5ee4b4f6e67936 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 5 Jun 2023 01:57:20 +0100 Subject: util/spkmodem-recv: print stats in other function Signed-off-by: Leah Rowe --- util/spkmodem_recv/spkmodem-recv.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'util/spkmodem_recv') diff --git a/util/spkmodem_recv/spkmodem-recv.c b/util/spkmodem_recv/spkmodem-recv.c index eb372fda..82ea5a63 100644 --- a/util/spkmodem_recv/spkmodem-recv.c +++ b/util/spkmodem_recv/spkmodem-recv.c @@ -30,6 +30,7 @@ void fetch_sample(void); void read_frame(int ringpos); int set_ascii_bit(void); void print_char(void); +void print_stats(void); int main(int argc, char *argv[]) @@ -101,13 +102,8 @@ read_frame(int ringpos) int set_ascii_bit(void) { - if (debug) { - long stdin_pos = 0; - if ((stdin_pos = ftell(stdin)) == -1) - err(ERR(), NULL); - printf ("%d %d %d @%ld\n", freq_data, freq_separator, - FREQ_DATA_THRESHOLD, stdin_pos - sizeof(frame)); - } + if (debug) + print_stats(); if (freq_data < FREQ_DATA_THRESHOLD) ascii |= (1 << ascii_bit); return ascii_bit; @@ -123,3 +119,13 @@ print_char(void) ascii_bit = 7; ascii = 0; } + +void +print_stats(void) +{ + long stdin_pos = 0; + if ((stdin_pos = ftell(stdin)) == -1) + err(ERR(), NULL); + printf ("%d %d %d @%ld\n", freq_data, freq_separator, + FREQ_DATA_THRESHOLD, stdin_pos - sizeof(frame)); +} -- cgit v1.2.1