@echo off
REM * This script will patch the emx C++ include headers
REM * to use headers with long filenames and filenames
REM * that include lower and uppercase characters.
REM *
REM * You need sed.exe to patch these files
REM * You should use WINZIP (or any zip tool with LFN support)
REM * to extract the C++ Headers from the gppdev.zip archive

sed -V
if not errorlevel=1 goto PATCH
echo Error: missing the program sed.exe
goto END

:PATCH
@echo on
REM ****** PATCHING ****************
sed -f long.sed cpp\bool.h > tmp
copy tmp cpp\bool.h
sed -f long.sed cpp\builtinb.h > tmp
copy tmp cpp\buildinb.h
sed -f long.sed cpp\CursesW.h > tmp
copy tmp cpp\CursesW.h
sed -f long.sed cpp\iostream.h > tmp
copy tmp cpp\iostream.h
sed -f long.sed cpp\libio.h > tmp
copy tmp cpp\libio.h
sed -f long.sed cpp\minmax.h > tmp
copy tmp cpp\minmax.h
sed -f long.sed cpp\parsestr.h > tmp
copy tmp cpp\parsestr.h
sed -f long.sed cpp\procbuf.h > tmp
copy tmp cpp\bprocbuf.h
sed -f long.sed cpp\RNG.h > tmp
copy tmp cpp\RNG.h
sed -f long.sed cpp\std.h > tmp
copy tmp cpp\std.h
sed -f long.sed cpp\streambu.h > tmp
copy tmp cpp\streambu.h
sed -f long.sed cpp\exceptio > tmp
copy tmp cpp\exceptio.h
sed -f long.sed cpp\stdexcep > tmp
copy tmp cpp\stdexcep.h
sed -f long.sed cpp\std\typeinfo.h > tmp
copy tmp cpp\std\typeinfo.h
sed -f long.sed cpp\gen\SplayNod.ccP > tmp
copy tmp cpp\std\SplayNod.ccP
sed -f long.sed cpp\std\cmath.h > tmp
copy tmp cpp\std\cmath.h
sed -f long.sed cpp\std\complext.h > tmp
copy tmp cpp\std\complext.h
sed -f long.sed cpp\std\stddef.h > tmp
copy tmp cpp\std\stddef.h
del tmp

REM ****** RENAMING ****************
ren unchecke.h unchecked.h
cd cpp
ren _G_confi.h _G_config.h
ren algorith algorithm
ren AllocRin.h AllocRing.h
ren BitStrin.h BitString.h
ren builtinb.h builtinbuf.h
ren exceptio exception
ren function.h functional
ren getpages.h getpagesize.h
ren Incremen.h Incremental.h
ren indstrea.h indstream.h
ren parsestr.h parsestream.h
ren stdexcep   stdexcept
ren stdiostr.h stdiostream.h
ren streambu.h streambuf.h
ren strstrea.h strstream.h
ren typemacr.h typemacros.h
cd gen
ren SplayNod.ccP SplayNode.ccP
ren SplayNod.hP SplayNode.hP
cd ..
cd std
ren exceptio.h exception.h
ren ldcomple.h ldcomplex.h
ren stdexcep.h stdexcept.h
cd ..
cd ..

rem cd objc
rem objc\typedstream.h
rem objc\NXConstStr.h
rem cd ..
:END
