]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
misc/check-doc.sh
authorWolfgang Bumiller <wry.git@bumiller.com>
Mon, 22 Apr 2013 10:22:24 +0000 (12:22 +0200)
committerWolfgang Bumiller <wry.git@bumiller.com>
Mon, 22 Apr 2013 10:22:24 +0000 (12:22 +0200)
misc/check-doc.sh [new file with mode: 0644]

diff --git a/misc/check-doc.sh b/misc/check-doc.sh
new file mode 100644 (file)
index 0000000..73b169a
--- /dev/null
@@ -0,0 +1,43 @@
+#!/bin/sh
+prog=$0
+
+die() {
+       echo "$@"
+       exit 1
+}
+
+want() {
+       test -e "$1" && return
+       echo "$prog: missing $1"
+       echo "$prog: run this script from the top of a gmqcc source tree"
+       exit 1
+}
+
+for i in opts.def          \
+         doc/gmqcc.1       \
+         gmqcc.ini.example
+do want "$i"; done
+
+# y/_ABCDEFGHIJKLMNOPQRSTUVWXYZ/-abcdefghijklmnopqrstuvwxyz/;
+check_opt() {
+       opt_def_name=$1
+       arg_char=$2
+
+       for i in $(sed -ne \
+       '/^#ifdef GMQCC_TYPE_'${opt_def_name}'$/,/^#endif/{
+               /GMQCC_DEFINE_FLAG/{
+                       s/^.*GMQCC_DEFINE_FLAG(\([^,)]*\)[),].*$/\1/;p;
+               }
+       }' opts.def)
+       do
+               opt=$(echo "$i" | tr -- '_A-Z' '-a-z')
+               grep -qF -- ".It Fl "${arg_char}" Ns Cm $opt" \
+                       doc/gmqcc.1 || echo "doc/gmqcc.1: missing: -${arg_char}$opt"
+               grep -q -- "[^a-zA-Z_]$i[^a-zA-Z_]" \
+                       gmqcc.ini.example || echo "gmqcc.ini.example: missing: $i"
+       done
+}
+
+check_opt FLAGS f
+check_opt WARNS W
+check_opt OPTIMIZATIONS O