[PATCH libnetfilter_queue 2/2] build: doc: Fix `fprintf` in man pages from using single quotes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxx>
---
 doxygen/build_man.sh | 17 +++++++++++++++--
 1 file 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
     }&
-- 
2.46.2





[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux