FreeCalypso > hg > freecalypso-hwlab
comparison 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 |
comparison
equal
deleted
inserted
replaced
108:6f80cfdc7e05 | 109:4aaf722ab933 |
---|---|
26 extern int cmd_select(); | 26 extern int cmd_select(); |
27 extern int cmd_spn(); | 27 extern int cmd_spn(); |
28 extern int cmd_telecom_sum(); | 28 extern int cmd_telecom_sum(); |
29 extern int cmd_unblock_chv(); | 29 extern int cmd_unblock_chv(); |
30 extern int cmd_update_bin(); | 30 extern int cmd_update_bin(); |
31 extern int cmd_update_bin_imm(); | |
31 extern int cmd_update_rec(); | 32 extern int cmd_update_rec(); |
32 extern int cmd_verify_chv(); | 33 extern int cmd_verify_chv(); |
33 | 34 |
34 extern int display_sim_resp_in_hex(); | 35 extern int display_sim_resp_in_hex(); |
35 | 36 |
71 {"unblock-chv1", 2, 2, cmd_unblock_chv}, | 72 {"unblock-chv1", 2, 2, cmd_unblock_chv}, |
72 {"unblock-chv2", 2, 2, cmd_unblock_chv}, | 73 {"unblock-chv2", 2, 2, cmd_unblock_chv}, |
73 {"unblock-pin1", 2, 2, cmd_unblock_chv}, | 74 {"unblock-pin1", 2, 2, cmd_unblock_chv}, |
74 {"unblock-pin2", 2, 2, cmd_unblock_chv}, | 75 {"unblock-pin2", 2, 2, cmd_unblock_chv}, |
75 {"update-bin", 2, 2, cmd_update_bin}, | 76 {"update-bin", 2, 2, cmd_update_bin}, |
77 {"update-bin-imm", 2, 2, cmd_update_bin_imm}, | |
76 {"update-rec", 2, 2, cmd_update_rec}, | 78 {"update-rec", 2, 2, cmd_update_rec}, |
77 {"verify-chv1", 1, 1, cmd_verify_chv}, | 79 {"verify-chv1", 1, 1, cmd_verify_chv}, |
78 {"verify-chv2", 1, 1, cmd_verify_chv}, | 80 {"verify-chv2", 1, 1, cmd_verify_chv}, |
79 {"verify-pin1", 1, 1, cmd_verify_chv}, | 81 {"verify-pin1", 1, 1, cmd_verify_chv}, |
80 {"verify-pin2", 1, 1, cmd_verify_chv}, | 82 {"verify-pin2", 1, 1, cmd_verify_chv}, |
111 break; | 113 break; |
112 if (ap - argv - 1 >= tp->maxargs) { | 114 if (ap - argv - 1 >= tp->maxargs) { |
113 fprintf(stderr, "error: too many arguments\n"); | 115 fprintf(stderr, "error: too many arguments\n"); |
114 return(-1); | 116 return(-1); |
115 } | 117 } |
116 *ap++ = cp; | 118 if (*cp == '"') { |
117 while (*cp && !isspace(*cp)) | 119 *ap++ = ++cp; |
118 cp++; | 120 while (*cp && *cp != '"') |
119 if (*cp) | 121 cp++; |
122 if (*cp != '"') { | |
123 fprintf(stderr, | |
124 "error: unterminated quoted string\n"); | |
125 return(-1); | |
126 } | |
120 *cp++ = '\0'; | 127 *cp++ = '\0'; |
128 } else { | |
129 *ap++ = cp; | |
130 while (*cp && !isspace(*cp)) | |
131 cp++; | |
132 if (*cp) | |
133 *cp++ = '\0'; | |
134 } | |
121 } | 135 } |
122 if (ap - argv - 1 < tp->minargs) { | 136 if (ap - argv - 1 < tp->minargs) { |
123 fprintf(stderr, "error: too few arguments\n"); | 137 fprintf(stderr, "error: too few arguments\n"); |
124 return(-1); | 138 return(-1); |
125 } | 139 } |