From: Wolfgang Bumiller Date: Mon, 22 Apr 2013 10:22:24 +0000 (+0200) Subject: misc/check-doc.sh X-Git-Tag: before-library~23 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=d6f62418728e0487f82dcc7d7156813a5302eea6;p=xonotic%2Fgmqcc.git misc/check-doc.sh --- diff --git a/misc/check-doc.sh b/misc/check-doc.sh new file mode 100644 index 0000000..73b169a --- /dev/null +++ b/misc/check-doc.sh @@ -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