#!/bin/sh

# PWD is not guaranteed to be set to the current directory in all cases
# (e.g., in /bin/sh, (cd src/mpe2 && maint/updatefiles won't set PWD to
# .../src/mpe2) The parent directory of where this script is located
saved_wd=`pwd`
cd `dirname $0`/.. && master_dir=`pwd`
cd $saved_wd

echo "Creating $master_dir/old_html...."
rm -fr $master_dir/old_html
mkdir $master_dir/old_html

cd $master_dir/html
infiles=`find . -name \*.html -print`
for file in $infiles ; do
    echo "Removing 'WIDTH=* HEIGHT=*' from $file..."
    mv $file $master_dir/old_html
    sed -e '
    /<IMG$/ {
        N
        s/WIDTH="[0-9]*" //
        s/HEIGHT="[0-9]*" //
    }' $master_dir/old_html/$file > $file
done
