diff options
author | Nikias Bassen | 2009-01-08 18:17:21 +0100 |
---|---|---|
committer | Matt Colyer | 2009-01-09 20:18:38 -0800 |
commit | 89ad220b093b73e229207ca2da0ad568d81f69e3 (patch) | |
tree | babb6c465ad3fd021068f7a86d55845590d06bad /src/utils.c | |
parent | cae85d48c44a9cf9b947a91aef6fbf7309398c4a (diff) | |
download | libimobiledevice-89ad220b093b73e229207ca2da0ad568d81f69e3.tar.gz libimobiledevice-89ad220b093b73e229207ca2da0ad568d81f69e3.tar.bz2 |
Perform proper goodby on lockdown shutdown.
Diffstat (limited to 'src/utils.c')
-rw-r--r-- | src/utils.c | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/src/utils.c b/src/utils.c index 049777a..fb98471 100644 --- a/src/utils.c +++ b/src/utils.c @@ -46,7 +46,7 @@ void log_debug_msg(const char *format, ...) va_start(args, format); if (toto_debug) - fprintf(stderr, format, args); + vfprintf(stderr, format, args); va_end(args); @@ -56,11 +56,35 @@ void log_debug_msg(const char *format, ...) inline void log_debug_buffer(const char *data, const int length) { #ifndef STRIP_DEBUG_CODE + int i; + int j; + unsigned char c; - /* run the real fprintf */ - if (toto_debug) - fwrite(data, 1, length, stderr); - + if (toto_debug) { + for (i = 0; i < length; i += 16) { + fprintf(stderr, "%04x: ", i); + for (j = 0; j < 16; j++) { + if (i + j >= length) { + fprintf(stderr, " "); + continue; + } + fprintf(stderr, "%02hhx ", *(data + i + j)); + } + fprintf(stderr, " | "); + for (j = 0; j < 16; j++) { + if (i + j >= length) + break; + c = *(data + i + j); + if ((c < 32) || (c > 127)) { + fprintf(stderr, "."); + continue; + } + fprintf(stderr, "%c", c); + } + fprintf(stderr, "\n"); + } + fprintf(stderr, "\n"); + } #endif } |