From b57bef91a12eb78dcd1fb3f106463b9081f09ef0 Mon Sep 17 00:00:00 2001 From: alberth Date: Sat, 7 Apr 2012 20:55:55 +0000 Subject: (svn r24099) -Add: Output list of -d option facilities with in the help text. --- src/debug.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/debug.cpp') diff --git a/src/debug.cpp b/src/debug.cpp index fe5b0d3fd..11166dafe 100644 --- a/src/debug.cpp +++ b/src/debug.cpp @@ -73,6 +73,31 @@ struct DebugLevel { }; #undef DEBUG_LEVEL +/** + * Dump the available debug facility names in the help text. + * @param buf Start address for storing the output. + * @param last Last valid address for storing the output. + * @return Next free position in the output. + */ +char *DumpDebugFacilityNames(char *buf, char *last) +{ + int length = 0; + for (const DebugLevel *i = debug_level; i != endof(debug_level); ++i) { + if (length == 0) { + buf = strecpy(buf, "List of debug facility names:\n", last); + } else { + buf = strecpy(buf, ", ", last); + length += 2; + } + buf = strecpy(buf, i->name, last); + length += strlen(i->name); + } + if (length > 0) { + buf = strecpy(buf, "\n\n", last); + } + return buf; +} + #if !defined(NO_DEBUG_MESSAGES) /** -- cgit v1.2.3-54-g00ecf