diff simtool/smsp_common.c @ 10:ddd767f6e15b

fc-simtool ported over
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 14 Mar 2021 07:11:25 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/simtool/smsp_common.c	Sun Mar 14 07:11:25 2021 +0000
@@ -0,0 +1,33 @@
+/*
+ * This module implements some common functions for working with EF_SMSP.
+ */
+
+#include <stdio.h>
+#include "curfile.h"
+#include "file_id.h"
+
+select_ef_smsp()
+{
+	int rc;
+
+	rc = select_op(DF_TELECOM);
+	if (rc < 0)
+		return(rc);
+	rc = select_op(EF_SMSP);
+	if (rc < 0)
+		return(rc);
+	rc = parse_ef_select_response();
+	if (rc < 0)
+		return(rc);
+	if (curfile_structure != 0x01) {
+		fprintf(stderr, "error: EF_SMSP is not linear fixed\n");
+		return(-1);
+	}
+	if (curfile_record_len < 28) {
+		fprintf(stderr,
+	"error: EF_SMSP has record length of %u bytes, less than minimum 28\n",
+			curfile_record_len);
+		return(-1);
+	}
+	return(0);
+}