changeset 934:0d6be90ae74f

rvinterf -v TM: send hex dump only to log file if we have one
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 23 May 2023 06:49:10 +0000
parents bd6dd6120180
children d203a9c7c4e6
files rvinterf/lowlevel/rviftmode.c
diffstat 1 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/rvinterf/lowlevel/rviftmode.c	Tue May 23 06:24:37 2023 +0000
+++ b/rvinterf/lowlevel/rviftmode.c	Tue May 23 06:49:10 2023 +0000
@@ -12,9 +12,19 @@
 
 extern u_char rxpkt[];
 extern size_t rxpkt_len;
+
 extern int verbose;
+extern FILE *logF;
 
-extern void output_cont();
+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)
@@ -22,7 +32,7 @@
 {
 	output_line("Sent Test Mode packet");
 	if (verbose >= 1)
-		packet_hex_dump(pkt, pktlen, output_cont);
+		packet_hex_dump(pkt, pktlen, hexdump_out);
 }
 
 void
@@ -30,5 +40,5 @@
 {
 	output_line("Rx Test Mode packet");
 	if (verbose >= 1)
-		packet_hex_dump(rxpkt, (unsigned) rxpkt_len, output_cont);
+		packet_hex_dump(rxpkt, (unsigned) rxpkt_len, hexdump_out);
 }