@if NOT EXIST setup.bat goto ERR1
call setup
call mdd temp
@set TEMP1=This_is_a_very_long_file_name_prefix_that_is_designed_to_cause_problems_with_appending_long_file_names_that_run_into_a_limit_of_the_ustar_tarX
@if NOT "%TEMP1%x" == "This_is_a_very_long_file_name_prefix_that_is_designed_to_cause_problems_with_appending_long_file_names_that_run_into_a_limit_of_the_ustar_tarXx" goto ERR2
@echo Make a very long named directory ...
@md %TEMP1%
@if NOT EXIST %TEMP1%\nul goto ERR3

@REM create the test files
@touch %TEMP1%\file1
@touch %TEMP1%\file2

%TEMPT% --create --file=archive %TEMP1%/file1
%TEMPT% --append --file=archive %TEMP1%/file2
%TEMPT% --list --file=archive
@echo Should see the full directory name, ending in an 'X', with file1 and file2 ...
@pause

@del archive > nul
%TEMPT% --create --file=archive --format=oldgnu %TEMP1%/file1
%TEMPT% --append --file=archive --format=oldgnu %TEMP1%/file2
%TEMPT% --list --file=archive
@echo Should see the full directory name, ending in an 'X', with file1 and file2 ...
@pause

@del archive > nul
%TEMPT% --create --file=archive --format=ustar %TEMP1%/file1
%TEMPT% --append --file=archive --format=ustar %TEMP1%/file2
%TEMPT% --list --file=archive
@echo Suggests this may FAIL, but it seems to work???
@echo Should see the full directory name, ending in an 'X', with file1 and file2 ...
@pause

@del archive > nul
%TEMPT% --create --file=archive --format=posix %TEMP1%/file1
%TEMPT% --append --file=archive --format=posix %TEMP1%/file2
%TEMPT% --list --file=archive
@echo Should see the full directory name, ending in an 'X', with file1 and file2 ...
@pause

@del archive > nul
%TEMPT% --create --file=archive --format=gnu %TEMP1%/file1
%TEMPT% --append --file=archive --format=gnu %TEMP1%/file2
%TEMPT% --list --file=archive
@echo Should see the full directory name, ending in an 'X', with file1 and file2 ...
@pause

@del archive > nul
%TEMPT% --create --file=archive --format=v7 %TEMP1%/file1
%TEMPT% --append --file=archive --format=v7 %TEMP1%/file2
%TEMPT% --list --file=archive
@echo This should FAIL ...
@pause

:RETURN
@cd ..
@goto END

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

:ERR2
@echo Environment failed - increase environment size ...
@pause
@goto RETURN

:ERR3
@echo ERROR: Unable to create directory for test ...
@pause
@goto RETURN


:END
