static void traceBuffer(const char * const label, const unsigned char * const buffer, unsigned int const size) { const char * const buffer_t = (const char *)buffer; size_t cursor; /* Index into buffer[] */ fprintf(stderr, "%s:\n\n", label); for (cursor = 0; cursor < size; ) { /* Print one line of buffer */ size_t const lineSize = nextLineSize(buffer_t, cursor, size); const char * const printableLine = xmlrpc_makePrintable_lp(&buffer_t[cursor], lineSize); fprintf(stderr, "%s\n", printableLine); cursor += lineSize; xmlrpc_strfree(printableLine); } fprintf(stderr, "\n"); }
const char * xmlrpc_makePrintable(const char *const input) { /*---------------------------------------------------------------------------- Convert an arbitrary string of characters (NUL-terminated, though) to printable ASCII. E.g. convert newlines to "\n". Return the result in newly malloc'ed storage. Return NULL if we can't get the storage. -----------------------------------------------------------------------------*/ return xmlrpc_makePrintable_lp(input, strlen(input)); }