[dvblast-devel] script to check dvblast parameters
Georgi Chorbadzhiyski
gf at unixsol.org
Tue Oct 29 09:51:37 CET 2013
dvblast have a lot of parameters described in several places. Keeping
track if everything is described is not something that should be done
manually.
I'm using the attached script to check if everything is fine. The script
is extremely ugly but it works (at least for me :) /must be run in the
directory where dvblast's source code is/.
--
Georgi Chorbadzhiyski | http://georgi.unixsol.org/ | http://github.com/gfto/
-------------- next part --------------
#!/bin/sh
OPTS=`grep getopt_long dvblast.c | sed -e 's|.*, \"||;s|\".*||;s|:||g;s|\(.\)|\1 |g'`
SOPTS=$((for i in $OPTS; do echo $i; done) | sort)
LOPTS=$(grep "^ { \"" dvblast.c | sed -e 's|.*{ \"||;s|".*||')
FOPTS=""
MANSYN="$(grep ^\\[ dvblast.1 | xargs echo)"
MANOPTS=$(sed -e 's|\\||g' dvblast.1 | grep ^fB | sed -e 's|^fB-||;s|,||;s|fR||g;s|fR||g;s|fB||g;s| <.*||;s| --| |')
SUSAGE="$(
(grep -A 20 'msg_Raw( NULL, \"Usage: ' dvblast.c | while read LINE
do
if [ "$LINE" = "" ]; then
break
fi
echo "$LINE" | sed -e 's|.* dvblast ||;s|\"||g;s|);||g'
done) | xargs echo
)"
echo -en "Short options that are free to use:\n "
for i in $(echo {A..Z}) $(echo {a..z}) $(echo {0..9})
do
echo $OPTS | grep -q $i 2>/dev/null
if [ $? != 0 ]
then
echo -n $i
FOPTS="$FOPTS $i"
fi
done
echo
echo -en "Options that are not process in dvblast.c:\n "
#AOPTS="$FOPTS $SOPTS"
AOPTS="$SOPTS"
for i in $AOPTS
do
grep -q "case '$i'" dvblast.c 2>/dev/null
[ $? != 0 ] && echo -n $i
done
echo
echo -en "Options that are not defined along long opts dvblast.c:\n "
for i in $AOPTS
do
grep -q "NULL, '$i' }," dvblast.c 2>/dev/null
[ $? != 0 ] && echo -n $i
done
echo
echo -en "No detailed help in dvblast.c for short options:\n "
for i in $AOPTS
do
grep -q "msg_Raw( NULL, \" -$i" dvblast.c 2>/dev/null
[ $? != 0 ] && echo -n $i
done
echo
echo -en "Not mentioned in dvblast.c usage:\n "
for i in $AOPTS
do
echo "$SUSAGE" | grep -q "\-$i" 2>/dev/null
[ $? != 0 ] && echo -n $i
done
echo
echo -en "Missing description in dvblast man page:\n "
for i in $AOPTS
do
grep -q "^\\\fB\\\-$i\\\fR, " dvblast.1 2>/dev/null
[ $? != 0 ] && echo -n $i
done
echo
echo -en "Not mentioned in dvblast man page synopsis:\n "
for i in $AOPTS
do
echo "$MANSYN" | grep -q "fI-$i" 2>/dev/null
[ $? != 0 ] && echo -n $i
done
echo
echo "No detailed help in dvblast.c for long options:"
for i in $LOPTS
do
grep -q "msg_Raw( NULL, \" -. --$i" dvblast.c 2>/dev/null
[ $? != 0 ] && echo " $i"
done
echo
echo "Missing description in dvblast man page:"
for i in $LOPTS
do
sed -e 's|\\||g' dvblast.1 | grep -q "fB--$i"
[ $? != 0 ] && echo " $i"
done
echo
echo "$MANOPTS" | while read s l
do
if [ "$(echo -n "$s" | wc -c)" != 1 ]
then
echo "Short MAN option error: \"$s $l\""
else
echo $AOPTS | grep -q $s
[ $? != 0 ] && echo "Unknown option described in MAN: $s"
fi
if [ "$l" = "" ]
then
echo "Missing long MAN option: \"$s $l\""
else
echo $LOPTS | grep -q $l
[ $? != 0 ] && echo "Unknown option described in MAN: $l"
fi
done
More information about the dvblast-devel
mailing list