changeset 55:4c570522de5d

fc-simtool iccid command: strip padding F digits from display
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 13 Feb 2021 19:42:14 +0000
parents 2d1679c7975b
children d4b5a6e547ca
files simtool/hlread.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/simtool/hlread.c	Sat Feb 13 06:44:34 2021 +0000
+++ b/simtool/hlread.c	Sat Feb 13 19:42:14 2021 +0000
@@ -11,7 +11,7 @@
 cmd_iccid()
 {
 	int rc;
-	char buf[21];
+	char buf[21], *cp;
 
 	rc = select_op(FILEID_MF);
 	if (rc < 0)
@@ -30,7 +30,9 @@
 	if (rc < 0)
 		return(rc);
 	decode_reversed_nibbles(sim_resp_data, 10, buf);
-	buf[20] = '\0';
+	for (cp = buf + 20; (cp > buf + 1) && (cp[-1] == 'F'); cp--)
+		;
+	*cp = '\0';
 	printf("%s\n", buf);
 	return(0);
 }