#!/bin/bash

SRC="src/*.c src/decoder/*.c src/decoder/*.cpp src/encoder/*.c"

echo Checking win32 port integrity

echo
echo AQUALUNG_*DIR:
grep "AQUALUNG_*" $SRC | grep DIR

echo
echo %s and / on the same line:
grep "/" $SRC | grep "%s"

echo
echo "xmlParseFile without AQUALUNG macro (no matches permitted!):"
grep xmlParseFile $SRC | grep -v AQUALUNG_xmlParseFile

echo
echo "xmlSaveFormatFile without AQUALUNG macro (no matches permitted!):"
grep xmlSaveFormatFile $SRC | grep -v AQUALUNG_xmlSaveFormatFile

echo
echo "usage of g_locale_to_utf8 (no matches permitted!):"
grep g_locale_to_utf8 $SRC

echo
echo "usage of g_locale_from_utf8 (no matches permitted!):"
grep g_locale_from_utf8 $SRC

echo
echo proper usage of GLib file utilities...

FUNCS="open rename mkdir stat unlink remove fopen freopen"

for i in $FUNCS ; do
    echo
    echo "g_$i() :"
    grep "\<$i(" $SRC | grep -v "g_$i("
done

