FreeCalypso > hg > freecalypso-hwlab
comparison uicc/main.c @ 130:f691a19f191d
fc-uicc-tool skeleton started
| author | Mychaela Falconia <falcon@freecalypso.org> | 
|---|---|
| date | Thu, 04 Feb 2021 00:08:12 +0000 | 
| parents | |
| children | 
   comparison
  equal
  deleted
  inserted
  replaced
| 129:2adb802b2a98 | 130:f691a19f191d | 
|---|---|
| 1 #include <sys/types.h> | |
| 2 #include <stdio.h> | |
| 3 #include <stdlib.h> | |
| 4 #include <pcsclite.h> | |
| 5 #include <winscard.h> | |
| 6 #include "globals.h" | |
| 7 | |
| 8 main(argc, argv) | |
| 9 char **argv; | |
| 10 { | |
| 11 char command[512]; | |
| 12 int rc; | |
| 13 | |
| 14 setup_pcsc_context(); | |
| 15 get_reader_name(); | |
| 16 printf("Card reader name: %s\n", reader_name_buf); | |
| 17 connect_to_card(); | |
| 18 retrieve_atr(); | |
| 19 if (argc >= 2) { | |
| 20 rc = dispatch_ready_argv(argc - 1, argv + 1); | |
| 21 if (rc) | |
| 22 error_exit(); | |
| 23 else | |
| 24 good_exit(); | |
| 25 } | |
| 26 for (;;) { | |
| 27 if (isatty(0)) { | |
| 28 fputs("uicc> ", stdout); | |
| 29 fflush(stdout); | |
| 30 } | |
| 31 if (!fgets(command, sizeof command, stdin)) | |
| 32 good_exit(); | |
| 33 simtool_dispatch_cmd(command, 0); | |
| 34 } | |
| 35 } | 
