diff miscutil/gsmx-to-tw5a.c @ 521:68fe269b4316

gsmx-to-tw5a: actually write to the output file
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 19 Sep 2024 02:21:08 +0000
parents 785b302992f0
children 5595293e4f29
line wrap: on
line diff
--- 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;
 		}
 	}