comparison simtool/pbdump.c @ 5:ce189c97b7b1

check_simresp_all_blank() factored out into libcommon
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 11 Feb 2021 23:31:51 +0000
parents 2071b28cd0c7
children 4a9bf783491d
comparison
equal deleted inserted replaced
4:744fabd6bd3f 5:ce189c97b7b1
10 #include "simresp.h" 10 #include "simresp.h"
11 #include "curfile.h" 11 #include "curfile.h"
12 12
13 static char gsm_address_digits[16] = 13 static char gsm_address_digits[16] =
14 {'0','1','2','3','4','5','6','7','8','9','*','#','a','b','c','?'}; 14 {'0','1','2','3','4','5','6','7','8','9','*','#','a','b','c','?'};
15
16 static
17 check_all_blank()
18 {
19 u_char *dp, *endp;
20
21 dp = sim_resp_data;
22 endp = sim_resp_data + sim_resp_data_len;
23 while (dp < endp)
24 if (*dp++ != 0xFF)
25 return(0);
26 return(1);
27 }
28 15
29 static 16 static
30 decode_number(data, nbytes, out) 17 decode_number(data, nbytes, out)
31 u_char *data; 18 u_char *data;
32 unsigned nbytes; 19 unsigned nbytes;
129 if (rc < 0) { 116 if (rc < 0) {
130 if (argv[2]) 117 if (argv[2])
131 fclose(outf); 118 fclose(outf);
132 return(rc); 119 return(rc);
133 } 120 }
134 if (check_all_blank()) 121 if (check_simresp_all_blank())
135 continue; 122 continue;
136 dump_record(recno, outf); 123 dump_record(recno, outf);
137 } 124 }
138 if (argv[2]) 125 if (argv[2])
139 fclose(outf); 126 fclose(outf);
171 endrec = startrec; 158 endrec = startrec;
172 for (recno = startrec; recno <= endrec; recno++) { 159 for (recno = startrec; recno <= endrec; recno++) {
173 rc = readrec_op(recno, 0x04, curfile_record_len); 160 rc = readrec_op(recno, 0x04, curfile_record_len);
174 if (rc < 0) 161 if (rc < 0)
175 return(rc); 162 return(rc);
176 if (check_all_blank()) 163 if (check_simresp_all_blank())
177 continue; 164 continue;
178 dump_record(recno, stdout); 165 dump_record(recno, stdout);
179 } 166 }
180 return(0); 167 return(0);
181 } 168 }