comparison uicc/dumpdir.c @ 15:b70d35f5476f

fc-uicc-tool ported over
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 14 Mar 2021 07:41:09 +0000
parents
children
comparison
equal deleted inserted replaced
14:b7ee2e85686b 15:b70d35f5476f
1 /*
2 * This module implements the dump of EF_DIR.
3 */
4
5 #include <sys/types.h>
6 #include <stdio.h>
7 #include "file_id.h"
8
9 cmd_dir(argc, argv, outf)
10 char **argv;
11 FILE *outf;
12 {
13 int rc;
14 unsigned record_len, record_count;
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 = select_resp_get_linear_fixed(&record_len, &record_count);
24 if (rc < 0)
25 return(rc);
26 if (record_len < 5) {
27 fprintf(stderr, "error: EF_DIR record length is too short\n");
28 return(-1);
29 }
30 for (recno = 1; recno <= record_count; recno++) {
31 rc = readrec_op(recno, 0x04, record_len);
32 if (rc < 0)
33 return(rc);
34 if (check_simresp_all_blank())
35 continue;
36 fprintf(outf, "Record #%u:\n", recno);
37 dump_efdir_record(outf);
38 }
39 return(0);
40 }