#!/bin/bash # V. simple script by Paul Millar (I'm putting my name to this hack?) # Available under BSD-license: do what you will with it. # Count number of Win32 API implemented, by counting matching comments: egrep -h "^ *\* *[A-Z][A-Za-z]*[^AW] *\([A-Z0-9]*\..*\)$" $(find . -name *.c -print)|awk '{print $2}'|sort -u > /tmp/count-$$ total=$(wc -l /tmp/count-$$|awk '{print $1}') for f in $(find . -path "*/tests/*.c" -print|grep -v '\.spec\.c'); do rm -f /tmp/count-found-$$ for x in $(cat /tmp/count-$$); do grep "$x" "$f" > /dev/null && echo $x >> /tmp/count-found-$$; done [ ! -f /tmp/count-found-$$ ] && continue if [ -f /tmp/count-tested-$$ ]; then cat /tmp/count-tested-$$ /tmp/count-found-$$ | sort -u > /tmp/count-tmp-$$ mv /tmp/count-tmp-$$ /tmp/count-tested-$$ else cp /tmp/count-found-$$ /tmp/count-tested-$$ fi # remove each entry from /tmp/count-found-$$ from /tmp/count-$$ for x in $(cat /tmp/count-found-$$); do grep -v "^$x\$" /tmp/count-$$ > /tmp/count-tmp-$$ && mv /tmp/count-tmp-$$ /tmp/count-$$ done done tested=$(wc -l /tmp/count-tested-$$|awk '{print $1}') echo -n "$total API functions implemented, $tested of them tested: " awk "END{print 100*$tested/$total, \"%\"}" < /dev/null rm /tmp/count-*-$$