FreeCalypso > hg > fc-pcsc-tools
comparison simtool/pnndump.c @ 214:8b1eecb56cb5
simtool code: select_ef_pnn() factored out
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 07 Mar 2021 08:07:07 +0000 |
parents | 2c07684a3980 |
children |
comparison
equal
deleted
inserted
replaced
213:50bdc48e7487 | 214:8b1eecb56cb5 |
---|---|
6 #include <sys/types.h> | 6 #include <sys/types.h> |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 #include "simresp.h" | 8 #include "simresp.h" |
9 #include "curfile.h" | 9 #include "curfile.h" |
10 #include "file_id.h" | 10 #include "file_id.h" |
11 | |
12 select_ef_pnn() | |
13 { | |
14 int rc; | |
15 | |
16 rc = select_op(DF_GSM); | |
17 if (rc < 0) | |
18 return(rc); | |
19 rc = select_op(EF_PNN); | |
20 if (rc < 0) | |
21 return(rc); | |
22 rc = parse_ef_select_response(); | |
23 if (rc < 0) | |
24 return(rc); | |
25 if (curfile_structure != 0x01) { | |
26 fprintf(stderr, "error: EF_PNN is not linear fixed\n"); | |
27 return(-1); | |
28 } | |
29 if (curfile_record_len < 3) { | |
30 fprintf(stderr, | |
31 "error: EF_PNN record length is less than the spec minimum of 3 bytes\n"); | |
32 return(-1); | |
33 } | |
34 return(0); | |
35 } | |
11 | 36 |
12 static void | 37 static void |
13 dump_record(recno, outf) | 38 dump_record(recno, outf) |
14 unsigned recno; | 39 unsigned recno; |
15 FILE *outf; | 40 FILE *outf; |
75 FILE *outf; | 100 FILE *outf; |
76 { | 101 { |
77 int rc; | 102 int rc; |
78 unsigned recno; | 103 unsigned recno; |
79 | 104 |
80 rc = select_op(DF_GSM); | 105 rc = select_ef_pnn(); |
81 if (rc < 0) | 106 if (rc < 0) |
82 return(rc); | 107 return(rc); |
83 rc = select_op(EF_PNN); | |
84 if (rc < 0) | |
85 return(rc); | |
86 rc = parse_ef_select_response(); | |
87 if (rc < 0) | |
88 return(rc); | |
89 if (curfile_structure != 0x01) { | |
90 fprintf(stderr, "error: EF_PNN is not linear fixed\n"); | |
91 return(-1); | |
92 } | |
93 if (curfile_record_len < 3) { | |
94 fprintf(stderr, | |
95 "error: EF_PNN record length is less than the spec minimum of 3 bytes\n"); | |
96 return(-1); | |
97 } | |
98 for (recno = 1; recno <= curfile_record_count; recno++) { | 108 for (recno = 1; recno <= curfile_record_count; recno++) { |
99 rc = readrec_op(recno, 0x04, curfile_record_len); | 109 rc = readrec_op(recno, 0x04, curfile_record_len); |
100 if (rc < 0) | 110 if (rc < 0) |
101 return(rc); | 111 return(rc); |
102 if (check_simresp_all_blank()) | 112 if (check_simresp_all_blank()) |