changeset 961:7da1ac6431dc

sms-pdu-decode utility: add -n option for TPDUs without SC address
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 04 Aug 2023 23:24:36 +0000
parents 411d1cc14326
children e3706ce1d01c
files uptools/sms-pdu-decode/sms-pdu-decode.c
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/uptools/sms-pdu-decode/sms-pdu-decode.c	Fri Aug 04 23:09:12 2023 +0000
+++ b/uptools/sms-pdu-decode/sms-pdu-decode.c	Fri Aug 04 23:24:36 2023 +0000
@@ -12,7 +12,7 @@
 
 static char *infname;
 static FILE *inf;
-static int keep_raw_pdu;
+static int keep_raw_pdu, pdu_has_sca = 1;
 
 static char input_line[1024];
 
@@ -23,7 +23,7 @@
 	int c;
 	extern int optind;
 
-	while ((c = getopt(argc, argv, "ehpu")) != EOF)
+	while ((c = getopt(argc, argv, "ehnpu")) != EOF)
 		switch (c) {
 		case 'e':
 			ascii_ext_mode = 1;
@@ -31,6 +31,9 @@
 		case 'h':
 			global_hexdump_mode = 1;
 			continue;
+		case 'n':
+			pdu_has_sca = 0;
+			continue;
 		case 'p':
 			keep_raw_pdu = 1;
 			continue;
@@ -88,7 +91,7 @@
 		pdu_length = cc;
 		if (keep_raw_pdu)
 			printf("%s\n\n", input_line);
-		process_pdu(1, 1);
+		process_pdu(1, pdu_has_sca);
 		putchar('\n');
 		swallow_empty_line();
 	}