X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Fdebug.c;h=35571547f656ed6c465509d6da102d357ab89ff1;hb=b7d3afcfad94edf99a8dbc50ab670ded417e6bea;hp=8f9359b15837b9702a9e6616d3cd583bdd21e6d5;hpb=829dd84217ed9c32fda88a4ca2cb20b41c950f1e;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/debug.c b/src/src/debug.c index 8f9359b15..35571547f 100644 --- a/src/src/debug.c +++ b/src/src/debug.c @@ -137,7 +137,7 @@ debug_printf("%s uid=%ld gid=%ld euid=%ld egid=%ld\n", s, *************************************************/ /* There are two entries, one for use when being called directly from a -function with a variable argument list. +function with a variable argument list, one for prepending an indent. If debug_pid is nonzero, print the pid at the start of each line. This is for tidier output when running parallel remote deliveries with debugging turned on. @@ -146,17 +146,28 @@ get interleaved. Since some calls to debug_printf() don't end with newline, we save up the text until we do get the newline. Take care to not disturb errno. */ + +/* Debug printf indented by ACL nest depth */ +void +debug_printf_indent(const char * format, ...) +{ +va_list ap; +va_start(ap, format); +debug_vprintf(acl_level + expand_level, format, ap); +va_end(ap); +} + void debug_printf(const char *format, ...) { va_list ap; va_start(ap, format); -debug_vprintf(format, ap); +debug_vprintf(0, format, ap); va_end(ap); } void -debug_vprintf(const char *format, va_list ap) +debug_vprintf(int indent, const char *format, va_list ap) { int save_errno = errno; @@ -195,6 +206,20 @@ if (debug_ptr == debug_buffer) debug_prefix_length = debug_ptr - debug_buffer; } +if (indent > 0) + { + int i; + for (i = indent >> 2; i > 0; i--) + { + Ustrcpy(debug_ptr, " " UTF8_VERT_2DASH); + debug_ptr += 6; /* 3 spaces + 3 UTF-8 octets */ + debug_prefix_length += 6; + } + Ustrncpy(debug_ptr, " ", indent &= 3); + debug_ptr += indent; + debug_prefix_length += indent; + } + /* Use the checked formatting routine to ensure that the buffer does not overflow. Ensure there's space for a newline at the end. */