comparison simtool/dumpdir.c @ 10:ddd767f6e15b

fc-simtool ported over
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 14 Mar 2021 07:11:25 +0000
parents
children
comparison
equal deleted inserted replaced
9:c9ef9e91dd8e 10:ddd767f6e15b
1 /*
2 * This module implements the dump of EF_DIR.
3 */
4
5 #include <sys/types.h>
6 #include <stdio.h>
7 #include "curfile.h"
8 #include "file_id.h"
9
10 cmd_uicc_dir(argc, argv, outf)
11 char **argv;
12 FILE *outf;
13 {
14 int rc;
15 unsigned recno;
16
17 rc = select_op(FILEID_MF);
18 if (rc < 0)
19 return(rc);
20 rc = select_op(EF_DIR);
21 if (rc < 0)
22 return(rc);
23 rc = parse_ef_select_response();
24 if (rc < 0)
25 return(rc);
26 if (curfile_structure != 0x01) {
27 fprintf(stderr, "error: EF_DIR is not linear fixed\n");
28 return(-1);
29 }
30 if (curfile_record_len < 5) {
31 fprintf(stderr, "error: EF_DIR record length is too short\n");
32 return(-1);
33 }
34 for (recno = 1; recno <= curfile_record_count; recno++) {
35 rc = readrec_op(recno, 0x04, curfile_record_len);
36 if (rc < 0)
37 return(rc);
38 if (check_simresp_all_blank())
39 continue;
40 fprintf(outf, "Record #%u:\n", recno);
41 dump_efdir_record(outf);
42 }
43 return(0);
44 }