FreeCalypso > hg > themwi-system-sw
view smpp-send/hexdump.c @ 240:c7a3ba56c636
themwi-short-dial: fix bug in printf arguments
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 14 Aug 2023 15:37:59 -0800 |
parents | f11c3e40c87a |
children |
line wrap: on
line source
/* * This module implements debug hex dump output of SMPP submit_sm PDUs * constructed by our smpp-send program. */ #include <sys/types.h> #include <stdio.h> void hex_dump_output(pdu, pdulen) u_char *pdu; unsigned pdulen; { unsigned off, chunk; int i, c; printf("Constructed PDU of %u bytes:\n", pdulen); for (off = 0; off < pdulen; off += chunk) { printf("%04X: ", off); chunk = pdulen - off; if (chunk > 16) chunk = 16; for (i = 0; i < 16; i++) { if (i < chunk) printf("%02X ", pdu[off + i]); else fputs(" ", stdout); if (i == 7 || i == 15) putchar(' '); } for (i = 0; i < chunk; i++) { c = pdu[off + i]; if (c < ' ' || c > '~') c = '.'; putchar(c); } putchar('\n'); } }