FreeCalypso > hg > freecalypso-hwlab
annotate simtool/dispatch.c @ 114:34c090f35515
fc-simtool: fix-sysmo-msisdn command implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 28 Jan 2021 01:46:40 +0000 |
parents | 87d459d9797a |
children | 0dcd666292e4 |
rev | line source |
---|---|
85
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * This module implements the command dispatch for fc-simtool |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 #include <sys/types.h> |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <ctype.h> |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdio.h> |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <string.h> |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 #include <strings.h> |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <stdlib.h> |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <pcsclite.h> |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 #include <winscard.h> |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 #include "globals.h" |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 |
108
6f80cfdc7e05
fc-simtool: CHV commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
104
diff
changeset
|
15 extern int cmd_change_chv(); |
6f80cfdc7e05
fc-simtool: CHV commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
104
diff
changeset
|
16 extern int cmd_disable_chv(); |
6f80cfdc7e05
fc-simtool: CHV commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
104
diff
changeset
|
17 extern int cmd_enable_chv(); |
114
34c090f35515
fc-simtool: fix-sysmo-msisdn command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
18 extern int cmd_fix_sysmo_msisdn(); |
96
a5dfab380a90
fc-simtool: iccid high-level read command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
95
diff
changeset
|
19 extern int cmd_iccid(); |
97
597c4e87a1f4
fc-simtool: imsi high-level read command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
96
diff
changeset
|
20 extern int cmd_imsi(); |
104
a60645b75a57
fc-simtool: phonebook dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
103
diff
changeset
|
21 extern int cmd_pb_dump(); |
112
87d459d9797a
fc-simtool: pb-erase command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
111
diff
changeset
|
22 extern int cmd_pb_erase(); |
111
5bfb5a7262c1
fc-simtool: pb-update command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
109
diff
changeset
|
23 extern int cmd_pb_update(); |
90
53e2c00566af
fc-simtool: readbin command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
88
diff
changeset
|
24 extern int cmd_readbin(); |
95
5f826e428641
fc-simtool: readef command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
91
diff
changeset
|
25 extern int cmd_readef(); |
91
226b231d00f3
fc-simtool: readrec command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
90
diff
changeset
|
26 extern int cmd_readrec(); |
100
fa7005185b84
fc-simtool: restore-file command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
99
diff
changeset
|
27 extern int cmd_restore_file(); |
99
2e35070d289f
fc-simtool: savebin command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
98
diff
changeset
|
28 extern int cmd_savebin(); |
85
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 extern int cmd_select(); |
103
90eff13a72fd
fc-simtool: implemented alpha field decoding and spn command
Mychaela Falconia <falcon@freecalypso.org>
parents:
102
diff
changeset
|
30 extern int cmd_spn(); |
98
66c0cb0e9876
fc-simtool: telecom-sum (summary info) command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
97
diff
changeset
|
31 extern int cmd_telecom_sum(); |
108
6f80cfdc7e05
fc-simtool: CHV commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
104
diff
changeset
|
32 extern int cmd_unblock_chv(); |
101
454ff8bd0b83
fc-simtool: update-bin command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
100
diff
changeset
|
33 extern int cmd_update_bin(); |
109
4aaf722ab933
fc-simtool: update-bin-imm command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
108
diff
changeset
|
34 extern int cmd_update_bin_imm(); |
102
29cc5612797a
fc-simtool: update-rec command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
101
diff
changeset
|
35 extern int cmd_update_rec(); |
108
6f80cfdc7e05
fc-simtool: CHV commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
104
diff
changeset
|
36 extern int cmd_verify_chv(); |
85
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 |
88
91486a77643e
fc-simtool: implement hex display of full SIM responses
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
38 extern int display_sim_resp_in_hex(); |
91486a77643e
fc-simtool: implement hex display of full SIM responses
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
39 |
85
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 cmd_exit() |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 { |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 SCardDisconnect(hCard, SCARD_UNPOWER_CARD); |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 SCardReleaseContext(hContext); |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 exit(0); |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 } |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 static struct cmdtab { |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 char *cmd; |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 int minargs; |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 int maxargs; |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 int (*func)(); |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 } cmdtab[] = { |
108
6f80cfdc7e05
fc-simtool: CHV commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
104
diff
changeset
|
53 {"change-chv1", 2, 2, cmd_change_chv}, |
6f80cfdc7e05
fc-simtool: CHV commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
104
diff
changeset
|
54 {"change-chv2", 2, 2, cmd_change_chv}, |
6f80cfdc7e05
fc-simtool: CHV commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
104
diff
changeset
|
55 {"change-pin1", 2, 2, cmd_change_chv}, |
6f80cfdc7e05
fc-simtool: CHV commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
104
diff
changeset
|
56 {"change-pin2", 2, 2, cmd_change_chv}, |
6f80cfdc7e05
fc-simtool: CHV commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
104
diff
changeset
|
57 {"disable-chv", 1, 1, cmd_disable_chv}, |
6f80cfdc7e05
fc-simtool: CHV commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
104
diff
changeset
|
58 {"disable-pin", 1, 1, cmd_disable_chv}, |
6f80cfdc7e05
fc-simtool: CHV commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
104
diff
changeset
|
59 {"enable-chv", 1, 1, cmd_enable_chv}, |
6f80cfdc7e05
fc-simtool: CHV commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
104
diff
changeset
|
60 {"enable-pin", 1, 1, cmd_enable_chv}, |
85
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 {"exit", 0, 0, cmd_exit}, |
114
34c090f35515
fc-simtool: fix-sysmo-msisdn command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
112
diff
changeset
|
62 {"fix-sysmo-msisdn", 0, 0, cmd_fix_sysmo_msisdn}, |
96
a5dfab380a90
fc-simtool: iccid high-level read command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
95
diff
changeset
|
63 {"iccid", 0, 0, cmd_iccid}, |
97
597c4e87a1f4
fc-simtool: imsi high-level read command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
96
diff
changeset
|
64 {"imsi", 0, 0, cmd_imsi}, |
104
a60645b75a57
fc-simtool: phonebook dump implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
103
diff
changeset
|
65 {"pb-dump", 1, 2, cmd_pb_dump}, |
112
87d459d9797a
fc-simtool: pb-erase command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
111
diff
changeset
|
66 {"pb-erase", 1, 1, cmd_pb_erase}, |
111
5bfb5a7262c1
fc-simtool: pb-update command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
109
diff
changeset
|
67 {"pb-update", 2, 2, cmd_pb_update}, |
85
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 {"quit", 0, 0, cmd_exit}, |
90
53e2c00566af
fc-simtool: readbin command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
88
diff
changeset
|
69 {"readbin", 2, 2, cmd_readbin}, |
95
5f826e428641
fc-simtool: readef command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
91
diff
changeset
|
70 {"readef", 1, 1, cmd_readef}, |
91
226b231d00f3
fc-simtool: readrec command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
90
diff
changeset
|
71 {"readrec", 1, 2, cmd_readrec}, |
100
fa7005185b84
fc-simtool: restore-file command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
99
diff
changeset
|
72 {"restore-file", 2, 2, cmd_restore_file}, |
99
2e35070d289f
fc-simtool: savebin command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
98
diff
changeset
|
73 {"savebin", 2, 2, cmd_savebin}, |
85
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
74 {"select", 1, 1, cmd_select}, |
88
91486a77643e
fc-simtool: implement hex display of full SIM responses
Mychaela Falconia <falcon@freecalypso.org>
parents:
85
diff
changeset
|
75 {"sim-resp", 0, 0, display_sim_resp_in_hex}, |
103
90eff13a72fd
fc-simtool: implemented alpha field decoding and spn command
Mychaela Falconia <falcon@freecalypso.org>
parents:
102
diff
changeset
|
76 {"spn", 0, 0, cmd_spn}, |
98
66c0cb0e9876
fc-simtool: telecom-sum (summary info) command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
97
diff
changeset
|
77 {"telecom-sum", 0, 0, cmd_telecom_sum}, |
108
6f80cfdc7e05
fc-simtool: CHV commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
104
diff
changeset
|
78 {"unblock-chv1", 2, 2, cmd_unblock_chv}, |
6f80cfdc7e05
fc-simtool: CHV commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
104
diff
changeset
|
79 {"unblock-chv2", 2, 2, cmd_unblock_chv}, |
6f80cfdc7e05
fc-simtool: CHV commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
104
diff
changeset
|
80 {"unblock-pin1", 2, 2, cmd_unblock_chv}, |
6f80cfdc7e05
fc-simtool: CHV commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
104
diff
changeset
|
81 {"unblock-pin2", 2, 2, cmd_unblock_chv}, |
101
454ff8bd0b83
fc-simtool: update-bin command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
100
diff
changeset
|
82 {"update-bin", 2, 2, cmd_update_bin}, |
109
4aaf722ab933
fc-simtool: update-bin-imm command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
108
diff
changeset
|
83 {"update-bin-imm", 2, 2, cmd_update_bin_imm}, |
102
29cc5612797a
fc-simtool: update-rec command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
101
diff
changeset
|
84 {"update-rec", 2, 2, cmd_update_rec}, |
108
6f80cfdc7e05
fc-simtool: CHV commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
104
diff
changeset
|
85 {"verify-chv1", 1, 1, cmd_verify_chv}, |
6f80cfdc7e05
fc-simtool: CHV commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
104
diff
changeset
|
86 {"verify-chv2", 1, 1, cmd_verify_chv}, |
6f80cfdc7e05
fc-simtool: CHV commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
104
diff
changeset
|
87 {"verify-pin1", 1, 1, cmd_verify_chv}, |
6f80cfdc7e05
fc-simtool: CHV commands implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
104
diff
changeset
|
88 {"verify-pin2", 1, 1, cmd_verify_chv}, |
85
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
89 {0, 0, 0, 0} |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
90 }; |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
91 |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
92 simtool_dispatch_cmd(cmd) |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
93 char *cmd; |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
94 { |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
95 char *argv[10]; |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
96 char *cp, **ap; |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
97 struct cmdtab *tp; |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
98 |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
99 for (cp = cmd; isspace(*cp); cp++) |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
100 ; |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
101 if (!*cp || *cp == '#') |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
102 return(0); |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
103 argv[0] = cp; |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
104 while (*cp && !isspace(*cp)) |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
105 cp++; |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
106 if (*cp) |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
107 *cp++ = '\0'; |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
108 for (tp = cmdtab; tp->cmd; tp++) |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
109 if (!strcmp(tp->cmd, argv[0])) |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
110 break; |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
111 if (!tp->func) { |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
112 fprintf(stderr, "error: no such command\n"); |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
113 return(-1); |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
114 } |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
115 for (ap = argv + 1; ; ) { |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
116 while (isspace(*cp)) |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
117 cp++; |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
118 if (!*cp || *cp == '#') |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
119 break; |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
120 if (ap - argv - 1 >= tp->maxargs) { |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
121 fprintf(stderr, "error: too many arguments\n"); |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
122 return(-1); |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
123 } |
109
4aaf722ab933
fc-simtool: update-bin-imm command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
108
diff
changeset
|
124 if (*cp == '"') { |
4aaf722ab933
fc-simtool: update-bin-imm command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
108
diff
changeset
|
125 *ap++ = ++cp; |
4aaf722ab933
fc-simtool: update-bin-imm command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
108
diff
changeset
|
126 while (*cp && *cp != '"') |
4aaf722ab933
fc-simtool: update-bin-imm command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
108
diff
changeset
|
127 cp++; |
4aaf722ab933
fc-simtool: update-bin-imm command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
108
diff
changeset
|
128 if (*cp != '"') { |
4aaf722ab933
fc-simtool: update-bin-imm command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
108
diff
changeset
|
129 fprintf(stderr, |
4aaf722ab933
fc-simtool: update-bin-imm command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
108
diff
changeset
|
130 "error: unterminated quoted string\n"); |
4aaf722ab933
fc-simtool: update-bin-imm command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
108
diff
changeset
|
131 return(-1); |
4aaf722ab933
fc-simtool: update-bin-imm command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
108
diff
changeset
|
132 } |
85
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
133 *cp++ = '\0'; |
109
4aaf722ab933
fc-simtool: update-bin-imm command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
108
diff
changeset
|
134 } else { |
4aaf722ab933
fc-simtool: update-bin-imm command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
108
diff
changeset
|
135 *ap++ = cp; |
4aaf722ab933
fc-simtool: update-bin-imm command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
108
diff
changeset
|
136 while (*cp && !isspace(*cp)) |
4aaf722ab933
fc-simtool: update-bin-imm command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
108
diff
changeset
|
137 cp++; |
4aaf722ab933
fc-simtool: update-bin-imm command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
108
diff
changeset
|
138 if (*cp) |
4aaf722ab933
fc-simtool: update-bin-imm command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
108
diff
changeset
|
139 *cp++ = '\0'; |
4aaf722ab933
fc-simtool: update-bin-imm command implemented
Mychaela Falconia <falcon@freecalypso.org>
parents:
108
diff
changeset
|
140 } |
85
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
141 } |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
142 if (ap - argv - 1 < tp->minargs) { |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
143 fprintf(stderr, "error: too few arguments\n"); |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
144 return(-1); |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
145 } |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
146 *ap = 0; |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
147 return tp->func(ap - argv, argv); |
b57cf64ece29
fc-simtool project started
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
148 } |