From d9b7123cb7dd4ed04f266aa48c35e70569ae258e Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 27 Oct 2010 15:19:05 +1100 Subject: librpc Make ndrdump use printf() rather than having to mess with DEBUG() This means it no longer needs to force the debug level etc. (this builds on the fine work by Volker to create dump_data_cb()) Andrew Bartlett --- librpc/ndr/libndr.h | 1 + librpc/ndr/ndr.c | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) (limited to 'librpc/ndr') diff --git a/librpc/ndr/libndr.h b/librpc/ndr/libndr.h index 6bc96cada6..06cc93a891 100644 --- a/librpc/ndr/libndr.h +++ b/librpc/ndr/libndr.h @@ -406,6 +406,7 @@ struct ndr_push *ndr_push_init_ctx(TALLOC_CTX *mem_ctx); DATA_BLOB ndr_push_blob(struct ndr_push *ndr); enum ndr_err_code ndr_push_expand(struct ndr_push *ndr, uint32_t extra_size); void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3); +void ndr_print_printf_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3); void ndr_print_string_helper(struct ndr_print *ndr, const char *format, ...) PRINTF_ATTRIBUTE(2,3); void ndr_print_debug(ndr_print_fn_t fn, const char *name, void *ptr); void ndr_print_union_debug(ndr_print_fn_t fn, const char *name, uint32_t level, void *ptr); diff --git a/librpc/ndr/ndr.c b/librpc/ndr/ndr.c index 3f553a7cbc..0e16a43525 100644 --- a/librpc/ndr/ndr.c +++ b/librpc/ndr/ndr.c @@ -190,6 +190,25 @@ _PUBLIC_ void ndr_print_debug_helper(struct ndr_print *ndr, const char *format, free(s); } +_PUBLIC_ void ndr_print_printf_helper(struct ndr_print *ndr, const char *format, ...) +{ + va_list ap; + int i; + + if (!ndr->no_newline) { + for (i=0;idepth;i++) { + printf(" "); + } + } + + va_start(ap, format); + vprintf(format, ap); + va_end(ap); + if (!ndr->no_newline) { + printf("\n"); + } +} + _PUBLIC_ void ndr_print_string_helper(struct ndr_print *ndr, const char *format, ...) { va_list ap; -- cgit