test_iff: Add small tool to test for IFF file structures

useful to see if an IFF file is malformed,
but also to see how many frames there is in an animation, etc.
This commit is contained in:
Thomas Bernard
2018-02-06 11:38:40 +01:00
parent 544a996361
commit d94fb966a2
5 changed files with 255 additions and 2 deletions

28
tools/test_iff/checkiff.sh Executable file
View File

@@ -0,0 +1,28 @@
#!/bin/sh
# set executable
PARSEIFF=./parseiff
if [ ! -x ${PARSEIFF} ] ; then
PARSEIFF="$(dirname $0)/parseiff"
fi
if [ "$1" = "" ] ; then
echo "Usage: $0 <file|directory>"
echo ""
echo "Just run the parser on files. For directories, list files with parsing errors."
exit 1
fi
if [ -d "$1" ] ; then
find "$1" |
while IFS= read line; do
if [ -f "$line" ] && file "$line" | grep -q "IFF data" ; then
${PARSEIFF} "$line" > /dev/null
#if ! ${PARSEIFF} "$line" > /dev/null ; then
# echo "error in $line"
#fi
fi
done
else
${PARSEIFF} $1
fi