@echo off
rem 14-04-2003 JvW Updated with write-protection check            (5.18)
rem 20-03-2004 JvW Renamed to DFSDISK for better readability      (6.04)
rem 05-10-2004 JvW Use new internal DFSDISK DFSee command         (6.14)
echo.
echo Get DFSee UNFDISK information

echo Checking write-permission in current directory ...
if exist _write_._ok del _write_._ok > NUL
echo test > _write_._ok
if exist _write_._ok goto writeok
echo.
echo ERROR: The current directory is write-protected or the disk is full
echo.
echo        Please change the current directory to a disk or diskette
echo        with more than 300Kb of available space ...
echo.
goto end
:writeok
if exist _write_._ok del _write_._ok > NUL

if "%0"=="DISKTEST"     echo on
if "%0"=="disktest"     echo on

if "%OS2_SHELL%"=="" goto notos2
set dfsexe=dfsos2.exe
set cmdext=CMD
goto dfsee
:notos2
if "%OS%"==""        goto notnt
if "%OS%"=="DOS"     goto notnt
if "%OS%"=="MSDOS"   goto notnt
if "%OS%"=="DRDOS"   goto notnt
if "%OS%"=="IBMDOS"  goto notnt
if "%OS%"=="OPENDOS" goto notnt
if "%OS%"=="FREEDOS" goto notnt
set dfsexe=dfswin.exe
set cmdext=BAT
goto dfsee
:notnt
set dfsexe=dfsdos.exe
set cmdext=BAT
:dfsee

if "%1" == "" echo (to get help on other usage just type:  '%0  ?')
echo.
if "%1" == "?"   goto usage
if "%1" == "/?"  goto usage
if "%1" == "-?"  goto usage

%dfsexe% -b -q query RValid
if not errorlevel 1 goto work
echo.
echo NOTE: Your DFSee version is not properly registred, this will cause
echo       some extra delays and reminder messages to be displayed  ...
echo.

:work
%dfsexe% -batch dfsdisk %1 %2 %3 %4 %5
if errorlevel 235 goto failure
if errorlevel 234 goto noscript
if errorlevel 001 goto failure

echo.
echo Resulting DFSee info logfiles:
dir dfsdiski.*
echo.
echo Check at least one of the dfsdiski.sk? files for obvious error messages
echo that could be corrected easily on a new run of %0! When it looks OK:
echo.
echo email these file(s) to support@dfsee.com for analysis (ZIP if possible)
echo Include as many details about the disk partitions as you remember.
echo.
goto end

:noscript
echo.
echo ERROR: The required DFSee script 'DFSDISK.DFS' was not found.
echo Check if it is in the current directory, the same directory
echo as the executable %dfsexe% or a directory on the PATH
goto end

:failure
echo.
echo WARNING: Execution of the DFSDISK script seems to have failed.
echo This could be the result of unexpected disk geometry or
echo other strange behaviour of disk-drivers, BIOS and so on
echo.
echo Also check if %dfsexe% and the script file DFSDISK.DFS can be
echo found in the current directory, or a directory on the PATH.
goto end

:usage
%dfsexe% dfsdisk -?
:end
