diff options
author | Leah Rowe <leah@libreboot.org> | 2023-06-05 01:57:20 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2023-06-05 01:57:20 +0100 |
commit | 4a6b5827779979873209f887cc5ee4b4f6e67936 (patch) | |
tree | 05a9387c3d55bb10e6d3ddcaef5730cb63c883a9 | |
parent | 2652a1ddfae2dc00cfd919ae421f4b7a2cc3a99a (diff) |
util/spkmodem-recv: print stats in other function
Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r-- | util/spkmodem_recv/spkmodem-recv.c | 20 |
1 files changed, 13 insertions, 7 deletions
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)); +} |