# HG changeset patch # User Mychaela Falconia # Date 1684910595 0 # Node ID ec5f51d33fdc3dbb92684e737e1fe0117f5697f7 # Parent 4d2e6a2dd1a185f19d3de30d33081371333e8c1e rvinterf code structure: factor out output_cont_logpref() diff -r 4d2e6a2dd1a1 -r ec5f51d33fdc rvinterf/lowlevel/output.c --- a/rvinterf/lowlevel/output.c Wed May 24 06:29:13 2023 +0000 +++ b/rvinterf/lowlevel/output.c Wed May 24 06:43:15 2023 +0000 @@ -50,3 +50,13 @@ if (logF) fprintf(logF, "%s\n", item); } + +void +output_cont_logpref(item) + char *item; +{ + if (logF) + fprintf(logF, "%s\n", item); + else if (!no_output) + printf("%s\n", item); +} diff -r 4d2e6a2dd1a1 -r ec5f51d33fdc rvinterf/lowlevel/rviftmode.c --- a/rvinterf/lowlevel/rviftmode.c Wed May 24 06:29:13 2023 +0000 +++ b/rvinterf/lowlevel/rviftmode.c Wed May 24 06:43:15 2023 +0000 @@ -17,7 +17,8 @@ extern size_t rxpkt_len; extern int verbose; -extern FILE *logF; + +extern void output_cont_logpref(); static int verify_cksum(pkt, pktlen) @@ -347,16 +348,6 @@ } } -static void -hexdump_out(line) - char *line; -{ - if (logF) - fprintf(logF, "%s\n", line); - else - printf("%s\n", line); -} - void log_sent_tm(pkt, pktlen) u_char *pkt; @@ -367,7 +358,7 @@ sprintf(headline, "Sent Test Mode cmd (%s)", summary); output_line(headline); if (verbose >= 1) - packet_hex_dump(pkt, pktlen, hexdump_out); + packet_hex_dump(pkt, pktlen, output_cont_logpref); } void @@ -379,5 +370,6 @@ sprintf(headline, "Rx Test Mode resp (%s)", summary); output_line(headline); if (verbose >= 1) - packet_hex_dump(rxpkt, (unsigned) rxpkt_len, hexdump_out); + packet_hex_dump(rxpkt, (unsigned) rxpkt_len, + output_cont_logpref); }