changeset 112:440a4582d2a5

fc-simtool opl-dump: support output redirection
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 19 Feb 2021 07:09:21 +0000
parents 869488ef86b6
children 32acef9d20ff
files simtool/dispatch.c simtool/opldump.c
diffstat 2 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/simtool/dispatch.c	Fri Feb 19 07:06:25 2021 +0000
+++ b/simtool/dispatch.c	Fri Feb 19 07:09:21 2021 +0000
@@ -132,7 +132,7 @@
 	{"lnd-erase", 0, 0, 0, cmd_lnd_erase},
 	{"lnd-restore", 1, 1, 0, cmd_lnd_restore},
 	{"lnd-write", 1, 2, 0, cmd_lnd_write},
-	{"opl-dump", 0, 0, 0, cmd_opl_dump},
+	{"opl-dump", 0, 0, 1, cmd_opl_dump},
 	{"pb-dump", 1, 1, 1, cmd_pb_dump},
 	{"pb-dump-rec", 2, 3, 1, cmd_pb_dump_rec},
 	{"pb-erase", 1, 1, 0, cmd_pb_erase},
--- a/simtool/opldump.c	Fri Feb 19 07:06:25 2021 +0000
+++ b/simtool/opldump.c	Fri Feb 19 07:09:21 2021 +0000
@@ -10,18 +10,21 @@
 #include "file_id.h"
 
 static void
-dump_record(recno)
+dump_record(recno, outf)
 	unsigned recno;
+	FILE *outf;
 {
 	char ascbuf[8];
 
 	decode_plmn_3bytes(sim_resp_data, ascbuf, 0);
-	printf("#%u: %s %02X%02X-%02X%02X %u\n", recno, ascbuf,
+	fprintf(outf, "#%u: %s %02X%02X-%02X%02X %u\n", recno, ascbuf,
 		sim_resp_data[3], sim_resp_data[4], sim_resp_data[5],
 		sim_resp_data[6], sim_resp_data[7]);
 }
 
-cmd_opl_dump()
+cmd_opl_dump(argc, argv, outf)
+	char **argv;
+	FILE *outf;
 {
 	int rc;
 	unsigned recno;
@@ -50,7 +53,7 @@
 			return(rc);
 		if (check_simresp_all_blank())
 			continue;
-		dump_record(recno);
+		dump_record(recno, outf);
 	}
 	return(0);
 }