comparison uptools/sms-pdu-decode/sms-pdu-decode.c @ 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
comparison
equal deleted inserted replaced
960:411d1cc14326 961:7da1ac6431dc
10 extern u_char pdu[176]; 10 extern u_char pdu[176];
11 extern unsigned pdu_length; 11 extern unsigned pdu_length;
12 12
13 static char *infname; 13 static char *infname;
14 static FILE *inf; 14 static FILE *inf;
15 static int keep_raw_pdu; 15 static int keep_raw_pdu, pdu_has_sca = 1;
16 16
17 static char input_line[1024]; 17 static char input_line[1024];
18 18
19 static 19 static
20 process_cmdline(argc, argv) 20 process_cmdline(argc, argv)
21 char **argv; 21 char **argv;
22 { 22 {
23 int c; 23 int c;
24 extern int optind; 24 extern int optind;
25 25
26 while ((c = getopt(argc, argv, "ehpu")) != EOF) 26 while ((c = getopt(argc, argv, "ehnpu")) != EOF)
27 switch (c) { 27 switch (c) {
28 case 'e': 28 case 'e':
29 ascii_ext_mode = 1; 29 ascii_ext_mode = 1;
30 continue; 30 continue;
31 case 'h': 31 case 'h':
32 global_hexdump_mode = 1; 32 global_hexdump_mode = 1;
33 continue;
34 case 'n':
35 pdu_has_sca = 0;
33 continue; 36 continue;
34 case 'p': 37 case 'p':
35 keep_raw_pdu = 1; 38 keep_raw_pdu = 1;
36 continue; 39 continue;
37 case 'u': 40 case 'u':
86 continue; 89 continue;
87 } 90 }
88 pdu_length = cc; 91 pdu_length = cc;
89 if (keep_raw_pdu) 92 if (keep_raw_pdu)
90 printf("%s\n\n", input_line); 93 printf("%s\n\n", input_line);
91 process_pdu(1, 1); 94 process_pdu(1, pdu_has_sca);
92 putchar('\n'); 95 putchar('\n');
93 swallow_empty_line(); 96 swallow_empty_line();
94 } 97 }
95 exit(0); 98 exit(0);
96 } 99 }