FreeCalypso > hg > fc-pcsc-tools
comparison simtool/a38.c @ 108:e17940d7ce35
fc-simtool a38: support output redirection
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 19 Feb 2021 06:45:42 +0000 |
parents | 2071b28cd0c7 |
children |
comparison
equal
deleted
inserted
replaced
107:f1836c8d36cb | 108:e17940d7ce35 |
---|---|
7 #include <ctype.h> | 7 #include <ctype.h> |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <stdlib.h> | 9 #include <stdlib.h> |
10 #include "simresp.h" | 10 #include "simresp.h" |
11 | 11 |
12 cmd_a38(argc, argv) | 12 cmd_a38(argc, argv, outf) |
13 char **argv; | 13 char **argv; |
14 FILE *outf; | |
14 { | 15 { |
15 u_char cmd[21]; | 16 u_char cmd[21]; |
16 int rc; | 17 int rc; |
17 | 18 |
18 /* RUN GSM ALGORITHM command APDU */ | 19 /* RUN GSM ALGORITHM command APDU */ |
48 fprintf(stderr, | 49 fprintf(stderr, |
49 "error: GET RESPONSE returned %u bytes, expected 12\n", | 50 "error: GET RESPONSE returned %u bytes, expected 12\n", |
50 sim_resp_data_len); | 51 sim_resp_data_len); |
51 return(-1); | 52 return(-1); |
52 } | 53 } |
53 printf("SRES: %02X %02X %02X %02X\n", sim_resp_data[0], | 54 fprintf(outf, "SRES: %02X %02X %02X %02X\n", sim_resp_data[0], |
54 sim_resp_data[1], sim_resp_data[2], sim_resp_data[3]); | 55 sim_resp_data[1], sim_resp_data[2], sim_resp_data[3]); |
55 printf("Kc: %02X %02X %02X %02X %02X %02X %02X %02X\n", | 56 fprintf(outf, "Kc: %02X %02X %02X %02X %02X %02X %02X %02X\n", |
56 sim_resp_data[4], sim_resp_data[5], sim_resp_data[6], | 57 sim_resp_data[4], sim_resp_data[5], sim_resp_data[6], |
57 sim_resp_data[7], sim_resp_data[8], sim_resp_data[9], | 58 sim_resp_data[7], sim_resp_data[8], sim_resp_data[9], |
58 sim_resp_data[10], sim_resp_data[11]); | 59 sim_resp_data[10], sim_resp_data[11]); |
59 return(0); | 60 return(0); |
60 } | 61 } |