annotate uicc/main.c @ 70:ce3752d3d3b4

doc/SIM-in-Calypso-phone: update for fc-host-tools-r15 release
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 27 Mar 2021 19:44:31 +0000
parents e2ef4b8e4136
children f6d5cff989d6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 #include <stdio.h>
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 #include <stdlib.h>
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 #include <unistd.h>
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5 extern char be_reader_name[];
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 extern char be_atr_string[];
46
e2ef4b8e4136 main tools: display spenh info when serial back end is used
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
7 extern char be_extra_info[];
15
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 main(argc, argv)
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 char **argv;
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 {
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 extern int optind;
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 char command[512];
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 int rc;
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 parse_global_options(argc, argv);
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 launch_backend();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 collect_backend_init_strings();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 if (argc > optind) {
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 rc = dispatch_ready_argv(argc - optind, argv + optind);
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21 if (rc)
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 exit(1);
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 else
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 good_exit();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25 }
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 if (be_reader_name[0])
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 printf("Card reader name: %s\n", be_reader_name);
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 if (be_atr_string[0])
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 printf("ATR: %s\n", be_atr_string);
46
e2ef4b8e4136 main tools: display spenh info when serial back end is used
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
30 if (be_extra_info[0])
e2ef4b8e4136 main tools: display spenh info when serial back end is used
Mychaela Falconia <falcon@freecalypso.org>
parents: 15
diff changeset
31 puts(be_extra_info);
15
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32 for (;;) {
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
33 if (isatty(0)) {
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
34 fputs("uicc> ", stdout);
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
35 fflush(stdout);
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 }
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
37 if (!fgets(command, sizeof command, stdin))
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
38 good_exit();
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39 simtool_dispatch_cmd(command, 0);
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
40 }
b70d35f5476f fc-uicc-tool ported over
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
41 }