From 71d75b85f10a0a9e312b355b9095636b6159f70e Mon Sep 17 00:00:00 2001 From: Christine Caulfield Date: Mon, 4 Jan 2021 10:01:31 +0000 Subject: [PATCH] doxygen2man: fix printing of lines starting with '.' if a line starts with a '.' (eg the '...' in qbarray.h) then nroff thinks it's looking for a macro called '..'. The easiest solution is to add a dummy format at the start of the line (just adding \ seems not to work). --- doxygen2man/doxygen2man.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/doxygen2man/doxygen2man.c b/doxygen2man/doxygen2man.c index ca064cdf0..dc96deb1e 100644 --- a/doxygen2man/doxygen2man.c +++ b/doxygen2man/doxygen2man.c @@ -222,7 +222,14 @@ static cstring_t get_codeline(xmlNode *this_tag) buffer = cstring_append_chars(buffer, " "); } if (strcmp((char*)sub_tag->name, "text") == 0) { - buffer = cstring_append_chars(buffer, (char*)sub_tag->content); + // If the line starts with a dot then escape the first one to + // stop nroff thinking it's a macro + char *tmp = (char*)sub_tag->content; + if (tmp[0] == '.') { + buffer = cstring_append_chars(buffer, (char*)"\\[char46]"); + tmp += 1; + } + buffer = cstring_append_chars(buffer, tmp); } if (strcmp((char*)sub_tag->name, "ref") == 0) { // Handled by the child recusion below