# HG changeset patch # User Mychaela Falconia # Date 1615141109 0 # Node ID 52c0da56e979453a61b1e4cda9d46014fab50aec # Parent cd66e13eccf345e3a7016d2beaf712c5fb0d86b2 simtool code: select_ef_opl() factored out diff -r cd66e13eccf3 -r 52c0da56e979 simtool/opldump.c --- a/simtool/opldump.c Sun Mar 07 18:03:55 2021 +0000 +++ b/simtool/opldump.c Sun Mar 07 18:18:29 2021 +0000 @@ -9,6 +9,31 @@ #include "curfile.h" #include "file_id.h" +select_ef_opl() +{ + int rc; + + rc = select_op(DF_GSM); + if (rc < 0) + return(rc); + rc = select_op(EF_OPL); + if (rc < 0) + return(rc); + rc = parse_ef_select_response(); + if (rc < 0) + return(rc); + if (curfile_structure != 0x01) { + fprintf(stderr, "error: EF_OPL is not linear fixed\n"); + return(-1); + } + if (curfile_record_len < 8) { + fprintf(stderr, +"error: EF_OPL record length is less than the spec minimum of 8 bytes\n"); + return(-1); + } + return(0); +} + static void dump_record(recno, outf) unsigned recno; @@ -29,24 +54,9 @@ int rc; unsigned recno; - rc = select_op(DF_GSM); - if (rc < 0) - return(rc); - rc = select_op(EF_OPL); - if (rc < 0) - return(rc); - rc = parse_ef_select_response(); + rc = select_ef_opl(); if (rc < 0) return(rc); - if (curfile_structure != 0x01) { - fprintf(stderr, "error: EF_OPL is not linear fixed\n"); - return(-1); - } - if (curfile_record_len < 8) { - fprintf(stderr, -"error: EF_OPL record length is less than the spec minimum of 8 bytes\n"); - return(-1); - } for (recno = 1; recno <= curfile_record_count; recno++) { rc = readrec_op(recno, 0x04, curfile_record_len); if (rc < 0)