diff simtool/dispatch.c @ 109:4aaf722ab933

fc-simtool: update-bin-imm command implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 26 Jan 2021 01:27:58 +0000
parents 6f80cfdc7e05
children 5bfb5a7262c1
line wrap: on
line diff
--- a/simtool/dispatch.c	Tue Jan 26 00:51:59 2021 +0000
+++ b/simtool/dispatch.c	Tue Jan 26 01:27:58 2021 +0000
@@ -28,6 +28,7 @@
 extern int cmd_telecom_sum();
 extern int cmd_unblock_chv();
 extern int cmd_update_bin();
+extern int cmd_update_bin_imm();
 extern int cmd_update_rec();
 extern int cmd_verify_chv();
 
@@ -73,6 +74,7 @@
 	{"unblock-pin1", 2, 2, cmd_unblock_chv},
 	{"unblock-pin2", 2, 2, cmd_unblock_chv},
 	{"update-bin", 2, 2, cmd_update_bin},
+	{"update-bin-imm", 2, 2, cmd_update_bin_imm},
 	{"update-rec", 2, 2, cmd_update_rec},
 	{"verify-chv1", 1, 1, cmd_verify_chv},
 	{"verify-chv2", 1, 1, cmd_verify_chv},
@@ -113,11 +115,23 @@
 			fprintf(stderr, "error: too many arguments\n");
 			return(-1);
 		}
-		*ap++ = cp;
-		while (*cp && !isspace(*cp))
-			cp++;
-		if (*cp)
+		if (*cp == '"') {
+			*ap++ = ++cp;
+			while (*cp && *cp != '"')
+				cp++;
+			if (*cp != '"') {
+				fprintf(stderr,
+					"error: unterminated quoted string\n");
+				return(-1);
+			}
 			*cp++ = '\0';
+		} else {
+			*ap++ = cp;
+			while (*cp && !isspace(*cp))
+				cp++;
+			if (*cp)
+				*cp++ = '\0';
+		}
 	}
 	if (ap - argv - 1 < tp->minargs) {
 		fprintf(stderr, "error: too few arguments\n");