FreeCalypso > hg > fc-pcsc-tools
diff uicc/select.c @ 138:58406ead2497
fc-uicc-tool: support output redirection for select commands
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 23 Feb 2021 02:34:46 +0000 |
parents | 1b1468869ccf |
children | 77832c9f2001 |
line wrap: on
line diff
--- a/uicc/select.c Mon Feb 22 00:08:42 2021 +0000 +++ b/uicc/select.c Tue Feb 23 02:34:46 2021 +0000 @@ -164,7 +164,8 @@ last_sel_file_record_len = reclen; } -parse_and_display_select_response() +parse_and_display_select_response(outf) + FILE *outf; { unsigned offset, totlen, reclen, n; u_char *dp, *endp; @@ -198,16 +199,17 @@ check_for_record_struct(dp); for (n = 0; n < reclen; n++) { if (n) - putchar(' '); - printf("%02X", *dp++); + putc(' ', outf); + fprintf(outf, "%02X", *dp++); } - putchar('\n'); + putc('\n', outf); } return(0); } -cmd_select(argc, argv) +cmd_select(argc, argv, outf) char **argv; + FILE *outf; { int file_id, rc; @@ -224,11 +226,12 @@ rc = select_op(file_id); if (rc < 0) return(rc); - return parse_and_display_select_response(); + return parse_and_display_select_response(outf); } -cmd_select_aid(argc, argv) +cmd_select_aid(argc, argv, outf) char **argv; + FILE *outf; { u_char aid[16]; unsigned aid_len; @@ -241,27 +244,31 @@ rc = select_aid_op(aid, aid_len); if (rc < 0) return(rc); - return parse_and_display_select_response(); + return parse_and_display_select_response(outf); } -cmd_select_usim() +cmd_select_usim(argc, argv, outf) + char **argv; + FILE *outf; { int rc; rc = select_aid_op(std_aid_usim, 7); if (rc < 0) return(rc); - return parse_and_display_select_response(); + return parse_and_display_select_response(outf); } -cmd_select_isim() +cmd_select_isim(argc, argv, outf) + char **argv; + FILE *outf; { int rc; rc = select_aid_op(std_aid_isim, 7); if (rc < 0) return(rc); - return parse_and_display_select_response(); + return parse_and_display_select_response(outf); } u_char *