# HG changeset patch # User Mychaela Falconia # Date 1615104427 0 # Node ID 8b1eecb56cb58bfdd8bed21c5a79e7fa20e1b9c2 # Parent 50bdc48e748703c48d03ac58eb8dab17b48d69b4 simtool code: select_ef_pnn() factored out diff -r 50bdc48e7487 -r 8b1eecb56cb5 simtool/pnndump.c --- a/simtool/pnndump.c Sun Mar 07 07:40:33 2021 +0000 +++ b/simtool/pnndump.c Sun Mar 07 08:07:07 2021 +0000 @@ -9,6 +9,31 @@ #include "curfile.h" #include "file_id.h" +select_ef_pnn() +{ + int rc; + + rc = select_op(DF_GSM); + if (rc < 0) + return(rc); + rc = select_op(EF_PNN); + if (rc < 0) + return(rc); + rc = parse_ef_select_response(); + if (rc < 0) + return(rc); + if (curfile_structure != 0x01) { + fprintf(stderr, "error: EF_PNN is not linear fixed\n"); + return(-1); + } + if (curfile_record_len < 3) { + fprintf(stderr, +"error: EF_PNN record length is less than the spec minimum of 3 bytes\n"); + return(-1); + } + return(0); +} + static void dump_record(recno, outf) unsigned recno; @@ -77,24 +102,9 @@ int rc; unsigned recno; - rc = select_op(DF_GSM); - if (rc < 0) - return(rc); - rc = select_op(EF_PNN); - if (rc < 0) - return(rc); - rc = parse_ef_select_response(); + rc = select_ef_pnn(); if (rc < 0) return(rc); - if (curfile_structure != 0x01) { - fprintf(stderr, "error: EF_PNN is not linear fixed\n"); - return(-1); - } - if (curfile_record_len < 3) { - fprintf(stderr, -"error: EF_PNN record length is less than the spec minimum of 3 bytes\n"); - return(-1); - } for (recno = 1; recno <= curfile_record_count; recno++) { rc = readrec_op(recno, 0x04, curfile_record_len); if (rc < 0)