# HG changeset patch # User Mychaela Falconia # Date 1613187157 0 # Node ID bbc2821288aaab4b2e09c09e7ca791b11724ea07 # Parent 9a21f4353158e69b14e98adb356776e64580adcb fc-simtool sst-dump: much more compact output diff -r 9a21f4353158 -r bbc2821288aa simtool/sstdump.c --- a/simtool/sstdump.c Sat Feb 13 03:09:44 2021 +0000 +++ b/simtool/sstdump.c Sat Feb 13 03:32:37 2021 +0000 @@ -12,7 +12,7 @@ cmd_sst_dump() { int rc; - unsigned byte, pos, code, nserv; + unsigned byte, pos, code, nserv, linelen; rc = select_op(DF_GSM); if (rc < 0) @@ -40,16 +40,28 @@ rc = readbin_op(0, curfile_total_size); if (rc < 0) return(rc); - nserv = 1; - for (byte = 0; byte < curfile_total_size; byte++) { - for (pos = 0; pos < 8; pos += 2) { + linelen = 0; + for (byte = 0, nserv = 1; byte < curfile_total_size; byte++) { + for (pos = 0; pos < 8; pos += 2, nserv++) { code = (sim_resp_data[byte] >> pos) & 3; - if (code == 3) - printf("#%u: activated\n", nserv); - else if (code == 1) - printf("#%u: allocated\n", nserv); - nserv++; + if (!(code & 1)) + continue; + if (linelen > 73) { + putchar('\n'); + linelen = 0; + } + if (linelen) { + putchar(' '); + linelen++; + } + linelen += printf("%u", nserv); + if (!(code & 2)) { + putchar('^'); + linelen++; + } } } + if (linelen) + putchar('\n'); return(0); }