diff simtool/smsp_set.c @ 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
line wrap: on
line diff
--- 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);
+}