@if NOT EXIST setup.bat goto ERR1
call setup
call mdd temp
@if NOT EXIST ..\delete03.bat goto ERR2

@set TEMPP=This_is_a_very_long_file_name_prefix_that_is_designed_to_cause_problems_with_file_names_that_run_into_a_limit_of_the_posix_tar_formatXX
@md %TEMPP%
@if NOT "%TEMPP%x" == "This_is_a_very_long_file_name_prefix_that_is_designed_to_cause_problems_with_file_names_that_run_into_a_limit_of_the_posix_tar_formatXXx" goto ERR3
@if NOT EXIST %TEMPP%\nul goto ERR4

@for %%i in (1 2 3 4 5 6 7 8 9) do @(call :ADDFIL %%i)

@echo Using Default format ...
@echo Add the directory and 9 files ...
@%TEMPT% --create --file=archive %TEMPP%
@REM %TEMPT% --create --file=archive %TEMPP%/*
@echo List the content ...
@%TEMPT% -tf archive 
@pause
@echo Delete file 5
@%TEMPT% --delete -f archive %TEMPP%/5
@echo List again ...
@%TEMPT% -tf archive 
@echo Should list 1-4 and 6-9 files ...
@pause

@del archive > nul
@echo Using gnu format ...
@echo Add the directory and 9 files ...
@%TEMPT% --create --format=gnu --file=archive %TEMPP%
@REM %TEMPT% --create --format=gnu --file=archive %TEMPP%/*
@echo List the content ...
@%TEMPT% -tf archive 
@pause
@echo Delete file 5
@%TEMPT% --delete --format=gnu -f archive %TEMPP%/5
@echo List again ...
@%TEMPT% -tf archive 
@echo Should list 1-4 and 6-9 files ...
@pause

@del archive > nul
@echo Using oldgnu format ...
@echo Add the directory and 9 files ...
@%TEMPT% --create --format=oldgnu --file=archive %TEMPP%
@REM %TEMPT% --create --format=oldgnu --file=archive %TEMPP%/*
@echo List the content ...
@%TEMPT% -tf archive 
@pause
@echo Delete file 5
@%TEMPT% --delete --format=oldgnu -f archive %TEMPP%/5
@echo List again ...
@%TEMPT% -tf archive 
@echo Should list 1-4 and 6-9 files ...
@pause

@del archive > nul
@echo Using posix format ...
@echo Add the directory and 9 files ...
@%TEMPT% --create --format=posix --file=archive %TEMPP%
@REM %TEMPT% --create --format=posix --file=archive %TEMPP%/*
@echo List the content ...
@%TEMPT% -tf archive 
@pause
@echo Delete file 5
@%TEMPT% --delete --format=posix -f archive %TEMPP%/5
@echo List again ...
@%TEMPT% -tf archive 
@echo Should list 1-4 and 6-9 files ...
@pause

@cd ..
@goto END

:ADDFIL
@if "%1x" == "x" goto :EOF
@touch %TEMPP%\%1
@if NOT EXIST %TEMPP%\%1 goto ERR6
@goto :EOF

:ERR1
@echo Can NOT locate setup.bat ... check name, location ...
@goto WAIT

:ERR2
@echo mdd.bat missing, or failed ... check name, location ...
@goto WAIT

:ERR3
@echo Environment did not accept long value ... increase enviroment size ...
@goto WAIT

:ERR4
@echo Failed to create LONG directory ... maybe increase enviroment size ...
@goto WAIT

:ERR6
@echo Failed to create a file in the LONG directory ... maybe touch is not in the PATH ...
@goto WAIT

:WAIT
@pause
@goto END

:END
