changeset 45:5bca197e7495

fc-simtool smsp-set-tag command implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 12 Feb 2021 23:54:12 +0000
parents f4eb1e83b4b3
children 32d6186668cf
files simtool/dispatch.c simtool/smsp_set.c
diffstat 2 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/simtool/dispatch.c	Fri Feb 12 23:48:01 2021 +0000
+++ b/simtool/dispatch.c	Fri Feb 12 23:54:12 2021 +0000
@@ -47,6 +47,7 @@
 extern int cmd_smsp_erase_range();
 extern int cmd_smsp_restore();
 extern int cmd_smsp_set();
+extern int cmd_smsp_set_tag();
 extern int cmd_spn();
 extern int cmd_telecom_sum();
 extern int cmd_uicc_dir();
@@ -119,6 +120,7 @@
 	{"smsp-erase-range", 2, 2, cmd_smsp_erase_range},
 	{"smsp-restore", 1, 1, cmd_smsp_restore},
 	{"smsp-set", 2, 6, cmd_smsp_set},
+	{"smsp-set-tag", 3, 7, cmd_smsp_set_tag},
 	{"spn", 0, 0, cmd_spn},
 	{"telecom-sum", 0, 0, cmd_telecom_sum},
 	{"uicc-dir", 0, 0, cmd_uicc_dir},
--- a/simtool/smsp_set.c	Fri Feb 12 23:48:01 2021 +0000
+++ b/simtool/smsp_set.c	Fri Feb 12 23:54:12 2021 +0000
@@ -136,3 +136,32 @@
 	}
 	return update_rec_op(recno, 0x04, record, curfile_record_len);
 }
+
+cmd_smsp_set_tag(argc, argv)
+	char **argv;
+{
+	int rc;
+	unsigned recno;
+	u_char record[255], *fixp;
+	char **ap;
+
+	rc = select_ef_smsp();
+	if (rc < 0)
+		return(rc);
+	recno = strtoul(argv[1], 0, 0);
+	if (recno < 1 || recno > curfile_record_count) {
+		fprintf(stderr, "error: specified record number is invalid\n");
+		return(-1);
+	}
+	memset(record, 0xFF, curfile_record_len);
+	rc = qstring_arg_to_gsm7(argv[2], record, curfile_record_len - 28);
+	if (rc < 0)
+		return(rc);
+	fixp = record + curfile_record_len - 28;
+	for (ap = argv + 3; *ap; ap++) {
+		rc = set_param(*ap, fixp);
+		if (rc < 0)
+			return(rc);
+	}
+	return update_rec_op(recno, 0x04, record, curfile_record_len);
+}