FreeCalypso > hg > freecalypso-hwlab
comparison simtool/saverestore.c @ 119:c77b0d4cf89f
fc-simtool: save-sms-bin command implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 28 Jan 2021 04:19:52 +0000 |
parents | b563ff1c1a2a |
children |
comparison
equal
deleted
inserted
replaced
118:b563ff1c1a2a | 119:c77b0d4cf89f |
---|---|
10 #include <stdlib.h> | 10 #include <stdlib.h> |
11 #include <unistd.h> | 11 #include <unistd.h> |
12 #include <pcsclite.h> | 12 #include <pcsclite.h> |
13 #include <winscard.h> | 13 #include <winscard.h> |
14 #include "globals.h" | 14 #include "globals.h" |
15 #include "file_id.h" | |
15 | 16 |
16 static | 17 static |
17 savebin_transparent(outf) | 18 savebin_transparent(outf) |
18 FILE *outf; | 19 FILE *outf; |
19 { | 20 { |
88 } | 89 } |
89 fclose(of); | 90 fclose(of); |
90 return(rc); | 91 return(rc); |
91 } | 92 } |
92 | 93 |
94 cmd_save_sms_bin(argc, argv) | |
95 char **argv; | |
96 { | |
97 int rc; | |
98 FILE *of; | |
99 | |
100 rc = select_op(DF_TELECOM); | |
101 if (rc < 0) | |
102 return(rc); | |
103 rc = select_op(EF_SMS); | |
104 if (rc < 0) | |
105 return(rc); | |
106 rc = parse_ef_select_response(); | |
107 if (rc < 0) | |
108 return(rc); | |
109 if (curfile_structure != 0x01 || curfile_record_len != 176) { | |
110 fprintf(stderr, | |
111 "error: EF_SMS is not linear fixed with 176-byte records\n"); | |
112 return(-1); | |
113 } | |
114 of = fopen(argv[1], "w"); | |
115 if (!of) { | |
116 perror(argv[1]); | |
117 return(-1); | |
118 } | |
119 rc = savebin_records(of); | |
120 fclose(of); | |
121 return(rc); | |
122 } | |
123 | |
93 static | 124 static |
94 restore_transparent(data) | 125 restore_transparent(data) |
95 u_char *data; | 126 u_char *data; |
96 { | 127 { |
97 unsigned off, cc; | 128 unsigned off, cc; |