changeset 29:aefc9fe653d3

fc-simtool: iccid reading refactored
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 17 Mar 2021 00:00:15 +0000
parents fa81221ac9b6
children 25530c262137
files simtool/hlread.c
diffstat 1 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/simtool/hlread.c	Tue Mar 16 23:37:36 2021 +0000
+++ b/simtool/hlread.c	Wed Mar 17 00:00:15 2021 +0000
@@ -8,12 +8,11 @@
 #include "curfile.h"
 #include "file_id.h"
 
-cmd_iccid(argc, argv, outf)
-	char **argv;
-	FILE *outf;
+retrieve_iccid(buf)
+	char *buf;
 {
 	int rc;
-	char buf[21], *cp;
+	char *cp;
 
 	rc = select_op(FILEID_MF);
 	if (rc < 0)
@@ -35,6 +34,19 @@
 	for (cp = buf + 20; (cp > buf + 1) && (cp[-1] == 'F'); cp--)
 		;
 	*cp = '\0';
+	return(0);
+}
+
+cmd_iccid(argc, argv, outf)
+	char **argv;
+	FILE *outf;
+{
+	int rc;
+	char buf[21];
+
+	rc = retrieve_iccid(buf);
+	if (rc < 0)
+		return(rc);
 	fprintf(outf, "%s\n", buf);
 	return(0);
 }