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