Home | History | Annotate | Line # | Download | only in mantools
      1 #!/bin/sh
      2 
      3 # Reports database configuration settings without proto/xxx_table documentation
      4 
      5 LANG=C; export LANG
      6 LC_ALL=C; export LC_ALL
      7 
      8 trap 'rm -f from-source.tmp from-doc.tmp 2>/dev/null' 0 1 2 3 15
      9 
     10 # For each database type, extract parameter names from its postconf
     11 # include file, and compare the result against a list of names from
     12 # the corresponding proto/xxx_table file.
     13 
     14 # Force a failure if the pcf*suffixes.h files do not exist. Avoid using
     15 # bash-specific shell features.
     16 for map in `(ls src/postconf/pcf*suffixes.h || kill $$) | 
     17 	sed 's;src/postconf/pcf_\(.*\)_suffixes.h$;\1;'`
     18 do
     19     # Extract parameter names from source code.
     20     tr -cd '[A-zA-z_0-9\12]' < src/postconf/pcf_${map}_suffixes.h | 
     21 	sort > from-source.tmp
     22     # Extract parameter names from documentation.
     23     sed -n '/^# *\.IP *"*\\fB\([a-zA-Z_0-9][a-zA-Z_0-9]*\).*/{
     24 	s//\1/
     25 	p
     26     }' proto/${map}_table | sort > from-doc.tmp
     27     cmp -s from-source.tmp from-doc.tmp || {
     28 	echo Settings in global/dict_${map}.c and proto/${map}_table differ.
     29 	diff from-source.tmp from-doc.tmp
     30     }
     31 done
     32 
     33