changeset 214:8b1eecb56cb5

simtool code: select_ef_pnn() factored out
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 07 Mar 2021 08:07:07 +0000
parents 50bdc48e7487
children 3a2f43460582
files simtool/pnndump.c
diffstat 1 files changed, 26 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- 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)