diff options
author | Duncan Roe <duncan_roe@optusnet.com.au> | 2024-12-21 14:13:49 +1100 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2025-01-06 11:01:43 +0100 |
commit | 60aa4279fabfbb10b15b99037d39bf34b4879f3d (patch) | |
tree | b6bb272ae9edf2366354f9a2604dd7125494f73b | |
parent | f54dc690e016c7eb3279d84d3409ee4f1fe9b910 (diff) |
build: doc: Fix `fprintf` in man pages from using single quotes
For example, `man nfq_open` shows
fprintf(stderr, 'error during nfq_open()\n');
where the single-quotes should be double-quotes (and are in the HTML).
This doxygen bug appeared in doxygen 1.9.2.
It is fixed in doxygen 1.13.0 (not yet released).
Fixes: 088c883bd1ca ("build: doc: Update build_man.sh for doxygen 1.9.2")
Signed-off-by: Duncan Roe <duncan_roe@optusnet.com.au>
Signed-off-by: Florian Westphal <fw@strlen.de>
-rwxr-xr-x | doxygen/build_man.sh | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/doxygen/build_man.sh b/doxygen/build_man.sh index a6531cb..8fda7ee 100755 --- a/doxygen/build_man.sh +++ b/doxygen/build_man.sh @@ -69,13 +69,19 @@ post_process(){ #keep_me=nfq_icmp_get_hdr.3 #do_diagnostics - # Decide if we need to fix rendering of verbatim "\n" + # Record doxygen version i=$(doxygen --version) doxymajor=$(echo $i|cut -f1 -d.) doxyminor=$(echo $i|cut -f2 -d.) + + # Decide if we need to fix rendering of verbatim "\n" [ $doxymajor -eq 1 -a $doxyminor -lt 9 ] && fix_newlines=true || fix_newlines=false - # + + # Decide if we need to fix double-to-single-quote conversion + [ $doxymajor -eq 1 -a $doxyminor -ge 9 -a $doxyminor < 13 ] && + fix_quotes = true || fix_quotes=false + # Work through the "real" man pages for target in $(ls -S | head -n$page_count) do grep -Eq "^\\.SH \"Function Documentation" $target || continue @@ -90,6 +96,13 @@ post_process(){ fix_double_blanks [ $# -ne 2 ] || insert_see_also $@ + # Work around doxygen bugs (doxygen version-specific) + + # Best effort: \" becomes \' + # Only do lines with some kind of printf, + # since other single quotes might be OK as-is. + $fix_quotes && sed -i '/printf/s/'\''/"/g' $target + # Fix rendering of verbatim "\n" (in code snippets) $fix_newlines && sed -i 's/\\n/\\\\n/' $target }& |