# HG changeset patch # User Mychaela Falconia # Date 1613718561 0 # Node ID 440a4582d2a58d2f1f45fb01375345821fc84ae5 # Parent 869488ef86b6b2b91cf68dd74fed9388d66c2fe1 fc-simtool opl-dump: support output redirection diff -r 869488ef86b6 -r 440a4582d2a5 simtool/dispatch.c --- 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}, diff -r 869488ef86b6 -r 440a4582d2a5 simtool/opldump.c --- 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); }