changeset 960:411d1cc14326

sms-pdu-decode family: prepare for SC address becoming optional
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 04 Aug 2023 23:09:12 +0000
parents c340f432cf03
children 7da1ac6431dc
files uptools/sms-pdu-decode/pcm-sms-decode.c uptools/sms-pdu-decode/pdu-common.c uptools/sms-pdu-decode/sms-pdu-decode.c
diffstat 3 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/uptools/sms-pdu-decode/pcm-sms-decode.c	Thu Jun 08 03:03:26 2023 +0000
+++ b/uptools/sms-pdu-decode/pcm-sms-decode.c	Fri Aug 04 23:09:12 2023 +0000
@@ -69,7 +69,7 @@
 			printf("Record #%u is %s message:\n", recno,
 				msgtype[(record[0] >> 1) & 3]);
 			bcopy(record + 1, pdu, 175);
-			process_pdu(0);
+			process_pdu(0, 1);
 			putchar('\n');
 		} else
 			printf("Record #%u is empty\n\n", recno);
--- a/uptools/sms-pdu-decode/pdu-common.c	Thu Jun 08 03:03:26 2023 +0000
+++ b/uptools/sms-pdu-decode/pdu-common.c	Fri Aug 04 23:09:12 2023 +0000
@@ -246,7 +246,7 @@
 	return(rc);
 }
 
-process_pdu(require_exact_length)
+process_pdu(require_exact_length, expect_sca)
 {
 	unsigned udl, udl_octets;
 	unsigned udhl, udh_octets, udh_chars, ud_chars;
@@ -254,8 +254,11 @@
 	int do_hexdump;
 	unsigned decoded_len;
 
-	if (handle_sca() < 0)
-		return(-1);
+	if (expect_sca) {
+		if (handle_sca() < 0)
+			return(-1);
+	} else
+		pdu_ptr = 0;
 	if (handle_first_octet() < 0)
 		return(-1);
 	if (first_octet & 2) {
--- a/uptools/sms-pdu-decode/sms-pdu-decode.c	Thu Jun 08 03:03:26 2023 +0000
+++ b/uptools/sms-pdu-decode/sms-pdu-decode.c	Fri Aug 04 23:09:12 2023 +0000
@@ -88,7 +88,7 @@
 		pdu_length = cc;
 		if (keep_raw_pdu)
 			printf("%s\n\n", input_line);
-		process_pdu(1);
+		process_pdu(1, 1);
 		putchar('\n');
 		swallow_empty_line();
 	}