FreeCalypso > hg > freecalypso-tools
comparison rvinterf/lowlevel/rviftmode.c @ 940:ec5f51d33fdc
rvinterf code structure: factor out output_cont_logpref()
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 24 May 2023 06:43:15 +0000 |
parents | 74930218c270 |
children |
comparison
equal
deleted
inserted
replaced
939:4d2e6a2dd1a1 | 940:ec5f51d33fdc |
---|---|
15 | 15 |
16 extern u_char rxpkt[]; | 16 extern u_char rxpkt[]; |
17 extern size_t rxpkt_len; | 17 extern size_t rxpkt_len; |
18 | 18 |
19 extern int verbose; | 19 extern int verbose; |
20 extern FILE *logF; | 20 |
21 extern void output_cont_logpref(); | |
21 | 22 |
22 static int | 23 static int |
23 verify_cksum(pkt, pktlen) | 24 verify_cksum(pkt, pktlen) |
24 u_char *pkt; | 25 u_char *pkt; |
25 unsigned pktlen; | 26 unsigned pktlen; |
345 default: | 346 default: |
346 sprintf(outbuf, "mid 0x%02X", pkt[1]); | 347 sprintf(outbuf, "mid 0x%02X", pkt[1]); |
347 } | 348 } |
348 } | 349 } |
349 | 350 |
350 static void | |
351 hexdump_out(line) | |
352 char *line; | |
353 { | |
354 if (logF) | |
355 fprintf(logF, "%s\n", line); | |
356 else | |
357 printf("%s\n", line); | |
358 } | |
359 | |
360 void | 351 void |
361 log_sent_tm(pkt, pktlen) | 352 log_sent_tm(pkt, pktlen) |
362 u_char *pkt; | 353 u_char *pkt; |
363 { | 354 { |
364 char summary[32], headline[80]; | 355 char summary[32], headline[80]; |
365 | 356 |
366 tm_classify(pkt, pktlen, 1, summary); | 357 tm_classify(pkt, pktlen, 1, summary); |
367 sprintf(headline, "Sent Test Mode cmd (%s)", summary); | 358 sprintf(headline, "Sent Test Mode cmd (%s)", summary); |
368 output_line(headline); | 359 output_line(headline); |
369 if (verbose >= 1) | 360 if (verbose >= 1) |
370 packet_hex_dump(pkt, pktlen, hexdump_out); | 361 packet_hex_dump(pkt, pktlen, output_cont_logpref); |
371 } | 362 } |
372 | 363 |
373 void | 364 void |
374 print_tm_output_new() | 365 print_tm_output_new() |
375 { | 366 { |
377 | 368 |
378 tm_classify(rxpkt, (unsigned) rxpkt_len, 0, summary); | 369 tm_classify(rxpkt, (unsigned) rxpkt_len, 0, summary); |
379 sprintf(headline, "Rx Test Mode resp (%s)", summary); | 370 sprintf(headline, "Rx Test Mode resp (%s)", summary); |
380 output_line(headline); | 371 output_line(headline); |
381 if (verbose >= 1) | 372 if (verbose >= 1) |
382 packet_hex_dump(rxpkt, (unsigned) rxpkt_len, hexdump_out); | 373 packet_hex_dump(rxpkt, (unsigned) rxpkt_len, |
383 } | 374 output_cont_logpref); |
375 } |