# HG changeset patch # User Mychaela Falconia # Date 1520633743 0 # Node ID bae0fd7285dd62c75c8677b5d76154d844089e6d # Parent ce3b57b8920b9be7bf1a8b45970329c8dab501df sms-pdu-decode: added -p option to keep the raw PDUs in the output diff -r ce3b57b8920b -r bae0fd7285dd uptools/sms-pdu-decode/sms-pdu-decode.c --- a/uptools/sms-pdu-decode/sms-pdu-decode.c Fri Mar 09 20:43:53 2018 +0000 +++ b/uptools/sms-pdu-decode/sms-pdu-decode.c Fri Mar 09 22:15:43 2018 +0000 @@ -8,7 +8,7 @@ char *infname; FILE *inf; -int ascii_ext_mode, global_hexdump_mode; +int ascii_ext_mode, global_hexdump_mode, keep_raw_pdu; char input_line[1024]; u_char pdu[176], first_octet; @@ -389,7 +389,7 @@ int c; extern int optind; - while ((c = getopt(argc, argv, "ehu")) != EOF) + while ((c = getopt(argc, argv, "ehpu")) != EOF) switch (c) { case 'e': ascii_ext_mode = 1; @@ -397,6 +397,9 @@ case 'h': global_hexdump_mode = 1; continue; + case 'p': + keep_raw_pdu = 1; + continue; case 'u': ascii_ext_mode = 2; continue; @@ -448,11 +451,9 @@ continue; } pdu_length = cc; - cc = process_pdu(); - if (cc < 0) { - /* decode error, dump the raw PDU */ - printf("\n%s\n", input_line); - } + if (keep_raw_pdu) + printf("%s\n\n", input_line); + process_pdu(); putchar('\n'); swallow_empty_line(); }