@setlocal
@set MVERS=07
@REM set MVERS=06 - FIX20110801 - Another try to get the running of gzip correct
@REM set MVERS=05 - FIX20090908 - also SET 'is_dumpdir' if a directory
@REM set MVERS=04 - 1.21.05 - EEK - some many changes stat to _stat64, size_t to size64.t, and off_t to off64.t !!!
@REM set MVERS=03 - genfile - use CreateFile(...) to get handle, and some offset to 64-bits
@REM set MVERS=02 - Some more testing - get it right!
@REM set MVERS=01 - Some further fixes to version 1.21.02 (beta, but looking ok)

@set TEMPA=tar
@set TEMPD=D:
@echo Update Release %TEMPA% to MDOS ... version %MVERS% ...
@echo Has diff been done?
@REM ask "and have you fixed all the #line references in lib/getdate.c?"
@ask "*** CONTINUE? ***"
@if ERRORLEVEL 2 goto ASKFAILED
@if ERRORLEVEL 1 goto DNASK
@echo Aborting ...
@goto END
:ASKFAILED
@echo It seems ask exited with %ERRORLEVEL% ...
@goto END
:DNASK
@if NOT EXIST tests\setup.bat goto DNCLEAN
@cd tests
@call setup
@cd ..
:DNCLEAN
nmake /nologo /f update.mak
@set TEMP1=%TEMPA%-%MVERS%.zip
@set TEMPE=%TEMPA%e%MVERS%.zip
@set TEMPW=%TEMPA%w%MVERS%.zip
@set TEMPX=%TEMP%\TEMPEXCL.TXT
@if EXIST %TEMPX% goto GotEx
Call QSEX %TEMPX%
@if NOT EXIST %TEMPX% goto Err2
:GotEx
@set TEMP2=-a
@if NOT EXIST %TEMP1% goto DoIt
@set TEMP2=-u
:DoIt
cd ..
call Zip8 %TEMP2% %1 %2 %3 %4 -p -r -o -x@%TEMPX% -xpo\* -xm4\* -x*.m4 -x*.at -x*.po -x*.gmo -x*.zip -x*.exe -x*.lib -x*.exp Win32\%TEMP1% *.*
@REM Ensure the two sources tempname.[ch] are ALSO included in the source ZIP
call Zip8 %TEMP2% %1 %2 %3 %4 -p -r -o Win32\%TEMP1% tempname.c tempname.h
call Zip8 %TEMP2% %1 %2 %3 %4 -P -r -o -x@%TEMPX% -x*.zip -x*.exe -x*.lib -x*.exp Win32\%TEMPW% Win32\*.*
cd Win32
@if NOT EXIST %TEMP1% goto Err1
@if NOT EXIST %TEMPD%\SAVES\. goto NoSAVE
@if NOT EXIST %TEMPD%\SAVES\nul goto NoSAVE
Copy %TEMP1% %TEMPD%\SAVES\.
@if NOT EXIST %TEMPE% goto NoSAVE2
Copy %TEMPE% %TEMPD%\SAVES\.
dir %TEMP1%
@goto DNSAVE
:NOSAVE
@echo WARNING: Folder %TEMPD%\SAVES\nul not found. NO SAVE DONE ..
@goto DNSAVE2

:DNSAVE
@if NOT EXIST %TEMPW% goto DNSAVE2
Copy %TEMPW% %TEMPD%\SAVES\.

:DNSAVE2
@echo Done local update ...
@if "%COMPUTERNAME%." == "PRO-2." goto DOPRO2
call savetod2 %TEMP1%
call savetod2 %TEMPE%
call savetod2 %TEMPW%
@goto DNNETS
:DOPRO2
call savetop %TEMP1%
call savetop %TEMPE%
call savetop %TEMPW%
:DNNETS

@echo Done NET saves ...
@goto End

:NOSAVE2
@echo WARNING: File %TEMPE% not found. NO SAVE DONE ..
@goto DNSAVE

:Err1
@echo	Must zip it first ... zip FAILED ...
@goto End

:Err2
@echo   ERROR: Unable to create file [%TEMPX%] !!!
@goto End

:End
@endlocal
