FreeCalypso > hg > fc-sim-tools
changeset 78:f6d5cff989d6
fc-uicc-tool batch stdin mode implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 09 Apr 2021 02:47:21 +0000 |
parents | 3fe1954f5dec |
children | 2a24e94400e8 |
files | uicc/main.c |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/uicc/main.c Fri Apr 09 02:46:01 2021 +0000 +++ b/uicc/main.c Fri Apr 09 02:47:21 2021 +0000 @@ -11,7 +11,7 @@ { extern int optind; char command[512]; - int rc; + int rc, batch_stdin; parse_global_options(argc, argv); launch_backend(); @@ -29,13 +29,18 @@ printf("ATR: %s\n", be_atr_string); if (be_extra_info[0]) puts(be_extra_info); + batch_stdin = !isatty(0); for (;;) { - if (isatty(0)) { + if (!batch_stdin) { fputs("uicc> ", stdout); fflush(stdout); } if (!fgets(command, sizeof command, stdin)) good_exit(); - simtool_dispatch_cmd(command, 0); + if (batch_stdin) + printf("Stdin command: %s", command); + rc = simtool_dispatch_cmd(command, 0); + if (batch_stdin && rc) + exit(1); } }