# HG changeset patch # User Mychaela Falconia # Date 1726712468 0 # Node ID 68fe269b43164c0f792f49dbd9d06dff558c7986 # Parent 785b302992f08259176a7e4591fa2a9c46a65d61 gsmx-to-tw5a: actually write to the output file diff -r 785b302992f0 -r 68fe269b4316 miscutil/gsmx-to-tw5a.c --- a/miscutil/gsmx-to-tw5a.c Thu Sep 19 01:06:58 2024 +0000 +++ b/miscutil/gsmx-to-tw5a.c Thu Sep 19 02:21:08 2024 +0000 @@ -16,15 +16,16 @@ #include "../libtest/binreader.h" static void -emit_hex_frame(frame, nbytes) +emit_hex_frame(outf, frame, nbytes) + FILE *outf; uint8_t *frame; unsigned nbytes; { unsigned n; for (n = 0; n < nbytes; n++) - printf("%02X", frame[n]); - putchar('\n'); + fprintf(outf, "%02X", frame[n]); + putc('\n', outf); } main(argc, argv) @@ -64,13 +65,13 @@ break; switch (frame[0] & 0xF0) { case 0xB0: - printf("%02X\n", 0xE6 | frame[1] & 1); + fprintf(outf, "%02X\n", 0xE6 | frame[1] & 1); break; case 0xC0: - emit_hex_frame(frame, EFR_RTP_FRAME_LEN); + emit_hex_frame(outf, frame, EFR_RTP_FRAME_LEN); break; case 0xD0: - emit_hex_frame(frame, GSMFR_RTP_FRAME_LEN); + emit_hex_frame(outf, frame, GSMFR_RTP_FRAME_LEN); break; } }