comparison uptools/sms-pdu-decode/pdu-common.c @ 804:30fbaa652ea5

pcm-sms-decode & sms-pdu-decode: rm remains of bad chars count
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 25 Mar 2021 03:26:23 +0000
parents 1c599681fd60
children 411d1cc14326
comparison
equal deleted inserted replaced
803:5637794913a8 804:30fbaa652ea5
250 { 250 {
251 unsigned udl, udl_octets; 251 unsigned udl, udl_octets;
252 unsigned udhl, udh_octets, udh_chars, ud_chars; 252 unsigned udhl, udh_octets, udh_chars, ud_chars;
253 u_char ud7[160], decode_buf[481]; 253 u_char ud7[160], decode_buf[481];
254 int do_hexdump; 254 int do_hexdump;
255 unsigned decoded_len, badchars; 255 unsigned decoded_len;
256 256
257 if (handle_sca() < 0) 257 if (handle_sca() < 0)
258 return(-1); 258 return(-1);
259 if (handle_first_octet() < 0) 259 if (handle_first_octet() < 0)
260 return(-1); 260 return(-1);
352 else { 352 else {
353 switch (dcs_distilled) { 353 switch (dcs_distilled) {
354 case 7: 354 case 7:
355 gsm7_to_ascii_or_ext(ud7 + udh_chars, ud_chars, 355 gsm7_to_ascii_or_ext(ud7 + udh_chars, ud_chars,
356 decode_buf, &decoded_len, 356 decode_buf, &decoded_len,
357 ascii_ext_mode, 1, 357 ascii_ext_mode, 1);
358 &badchars);
359 break; 358 break;
360 case 16: 359 case 16:
361 ucs2_to_ascii_or_ext(pdu + pdu_ptr + udh_chars, 360 ucs2_to_ascii_or_ext(pdu + pdu_ptr + udh_chars,
362 ud_chars, 361 ud_chars,
363 decode_buf, &decoded_len, 362 decode_buf, &decoded_len,
364 ascii_ext_mode, 1, 363 ascii_ext_mode, 1);
365 &badchars);
366 break; 364 break;
367 } 365 }
368 printf("Length: %u", ud_chars); 366 printf("Length: %u", ud_chars);
369 if (decoded_len != ud_chars) 367 if (decoded_len != ud_chars)
370 printf("->%u", decoded_len); 368 printf("->%u", decoded_len);
371 if (badchars)
372 printf(" (%u bad char%s)", badchars,
373 badchars != 1 ? "s" : "");
374 putchar('\n'); 369 putchar('\n');
375 } 370 }
376 } 371 }
377 372
378 if (udhl) { 373 if (udhl) {