comparison simtool/pbdump.c @ 58:1861d9fb7751

fc-simtool dump-lnd command implemented
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 13 Feb 2021 21:40:38 +0000
parents 72a24b8538eb
children 0b29c0d19db4
comparison
equal deleted inserted replaced
57:10030acba82f 58:1861d9fb7751
5 #include <sys/types.h> 5 #include <sys/types.h>
6 #include <stdio.h> 6 #include <stdio.h>
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include "simresp.h" 8 #include "simresp.h"
9 #include "curfile.h" 9 #include "curfile.h"
10 #include "file_id.h"
10 11
11 static 12 static
12 check_blank_area(dp, endp) 13 check_blank_area(dp, endp)
13 u_char *dp, *endp; 14 u_char *dp, *endp;
14 { 15 {
129 continue; 130 continue;
130 dump_record(recno, stdout); 131 dump_record(recno, stdout);
131 } 132 }
132 return(0); 133 return(0);
133 } 134 }
135
136 cmd_dump_lnd()
137 {
138 int rc;
139 unsigned recno;
140
141 rc = select_op(DF_TELECOM);
142 if (rc < 0)
143 return(rc);
144 rc = select_op(EF_LND);
145 if (rc < 0)
146 return(rc);
147 rc = parse_ef_select_response();
148 if (rc < 0)
149 return(rc);
150 if (curfile_structure != 0x03) {
151 fprintf(stderr, "error: EF_LND is not cyclic\n");
152 return(-1);
153 }
154 if (curfile_record_len < 14) {
155 fprintf(stderr,
156 "error: EF_LND has record length of %u bytes, less than minimum 14\n",
157 curfile_record_len);
158 return(-1);
159 }
160 for (recno = 1; recno <= curfile_record_count; recno++) {
161 rc = readrec_op(recno, 0x04, curfile_record_len);
162 if (rc < 0)
163 return(rc);
164 if (check_simresp_all_blank())
165 continue;
166 dump_record(recno, stdout);
167 }
168 return(0);
169 }