home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-12-13 | 31.8 KB | 1,067 lines |
- @ECHO OFF
- REM ----------------------------------------
- REM
- REM DESC.BTM Copyright 1993 by Bernd Schemmer Version 2.11
- REM
- REM Last Update: 13.12.93 /bs
- REM
- REM Description:
- REM Create/Edit descriptions for 4DOS/4OS2
- REM DESC can also view text files and files in archivs.
- REM DESC supports the archivs .LZH, .LHA, .ICE, .ARJ, .ARC
- REM .PAK, .ZOO, .SQZ and .ZIP. So you may use DESC as a
- REM replacement for the internal list command of 4DOS.
- REM
- REM Requirements:
- REM MS-DOS 3+ and 4DOS 4+ *OR* OS/2 1.3+ and 4OS2
- REM Additional needed programs to view the contents of an archiv:
- REM ARJ.EXE, LHA.EXE, PAK.EXE, ZOO.EXE, SQZ.EXE and PKUNZIP.EXE
- REM
- REM Usage:
- REM DESC {file|directory} {...}
- REM or (only to show one or more files or archivs)
- REM DESC **view** {file|directory} {...}
- REM You should use an alias like
- REM ALIAS list desc **view** %&
- REM for the second usage.
- REM
- REM Used internal 4DOS/4OS2-Variables:
- REM %_dos%, %_dosver%, %_fg, %_bg, %_rows, %_columns, %_cwd, %_4ver,
- REM %_disk, %_date, %_time, %_? %_lastdisk
- REM
- REM Additional used internal 4DOS-Vars if started under 4DOS:
- REM %_env%, %_alias%
- REM
- REM Input-Variables (if set):
- REM %ipath% - path for the file data files and init file of DESC
- REM (default: path where DESC.BTM is located)
- REM %tmp% - path for temporay files
- REM (default: C:\)
- REM %DOSarc% - path with the pack programs for DOS-Version
- REM %OS2arc% - path with the pack programs for OS/2-Version
- REM
- REM Used internal 4DOS/4OS2 commands (DESC ingores ALIASse for this commands):
- REM SET, UNSET, LIST
- REM
- REM Additional files created in the directory "iPath" from DESC.BTM:
- REM DESCINIT.BTM - general init file for DESC.BTM
- REM DESCDRVM - Drive Map
- REM DESCTREE.x - Directory of drive x where x is the drive char
- REM ( 'A' <= x <= 'Z')
- REM
- REM Warranty disclaimer:
- REM Bernd Schemmer makes no warranty of any kind, expressed or implied,
- REM including without limitation any warranties of merchantability and/or
- REM fitness for a particular purpose.
- REM
- REM DESC.BTM is freeware. So use and share it freely!
- REM Send any comments and bug reports to
- REM
- REM Bernd Schemmer
- REM Bäckerweg 48
- REM 60316 Frankfurt/M.
- REM Germany
- REM Phone: +49 (069) 4 97 04 84 (only in the evening of MEZ)
- REM
- REM Note: You may delete the comments at the beginning of this file to speed
- REM up the execution. You may NOT distribute this file without the
- REM comments, generally speaking: YOU ARE ONLY ALLOWED TO DISTRIBUTE
- REM THIS FILE IN THE ORIGINAL FORM!
- REM
- REM Hints:
- REM Change the variables "DOSArc" and "OS2Arc" if your packers are in
- REM another directory.
- REM If the file DESCINIT.BTM exists, you must also change this variables
- REM in this file - or delete DESCINIT.BTM
- REM
- REM Set the variable "iPath" if you want DESC to save it's initfile in
- REM a special directory.
- REM The Search-Algorithm for "iPath" is:
- REM
- REM IFF EXIST DESCINIT.BTM
- REM REM use local DESCINIT.BTM in the current directory
- REM SET ipath=%_cwds
- REM ELSEIFF "%ipath%" != "" .AND. isDir %ipath% THEN
- REM REM use predefined "ipath"
- REM ELSE
- REM SET ipath=directory with DESC.BTM
- REM ENDIFF
- REM
- REM To work propper, KSTACK should be loaded (DOS-Version).
- REM
- REM If you're getting a error message after moving DESC.BTM from one
- REM drive/directory to another -- delete the file DESCINIT.BTM.
- REM
- REM You may add or delete magics for the filename mask (stored
- REM in the environment variable MAGICS) in the OS-Shell while DESC
- REM is running - DESC saves the contents of the variable MAGICS and
- REM the contents of all magics automaticly at program end.
- REM
- REM Example: To add the magic TEXT issue the following commands in
- REM the OS-Shell from DESC:
- REM SET TEXT=*.TXT;*.DOC;*.LST
- REM SET MAGICS=%MAGICS% TEXT
- REM That's all! If you'll leave DESC and call it again
- REM the new magic TEXT is always there.
- REM
- REM DESC make the following assumptions about the format of
- REM the file listings generated by the packers (see also
- REM the function 'ViewFile' in this source):
- REM
- REM Archiv-Typ Word, containing the filename (1..n)
- REM ----------------------------------------------------
- REM ARJ 1 Word
- REM LHA, ICE, LZH 1 Word
- REM SQZ 1 Word
- REM ZIP 9 Word
- REM ZOO 7 Word
- REM PAK, ARC 1 Word
- REM
- REM History: V1.00 - first release
- REM V1.10 - DESC is now compound char independent
- REM DESC now returns the following errorlevels:
- REM 0 = okay
- REM 1 = error
- REM 2 = user pressed ALT-X
- REM DESC can now edit the descriptions of hidden
- REM and system files in single edit mode (not in
- REM 'edit some descriptions')
- REM V1.11 - minor changes
- REM V2.00 - changes for 4OS2 (only FAT partitions, because
- REM 4OS2 won't show descriptions for HPFS partitions)
- REM Caution: DESC therefore shows HPFS partitions in
- REM FAT-Format
- REM Note that you must use the char % as parameter char
- REM to use DESC under 4OS2. Note also that this file DON'T
- REM uses the compound char of 4DOS/4OS2.
- REM add support for .PAK-archivs
- REM V2.10 - add support for SFX archivs
- REM add support for .ARC-archivs
- REM add parameter **view**
- REM add support for jokers in the parameters
- REM DESC now supports local init files
- REM DESC now supports separat pathes for the pack programs
- REM in the DOS-Version and in the OS/2-Version
- REM But note that all pack programs MUST generate the same
- REM archiv listing in the DOS- and the OS/2-Version!
- REM V2.11 - minor bug fixes
- REM
- REM --------
-
- SETLOCAL
- ECHO.
-
- *SET xParm=**view**
- REM desc init file
- *SET initFile=DESCINIT.BTM
-
- IFF "%1%" == "%xParm%" THEN
- UNSET /q descActiv
- IFF "%2%" == "" THEN
- ECHO. [DESC] Missing parameters!
- QUIT 1
- ENDIFF
- ENDIFF
-
- REM don't fake me!
- *UNSET /Q _dos _dosVer _4ver _env _alias
- REM Check OS and 4DOS version
- IFF "%_dos%" == "OS2" THEN
- REM Running under 4OS2
- *SET _dosVer=OS/2
- ELSEIFF "%_dos%" == "DOS" THEN
- REM Running under 4DOS
- IFF %@name[%_dosver%]0 GT 100 THEN
- *SET _dosVer=OS/2 %@substr[%_dosver,0,1].%@substr[%_dosver%,3,2] DOS-BOX
- ELSEIFF %@name[%_4VER%]0 LT 40 .OR. %@name[%_DOSVER]0 LT 30 THEN
- ECHO. Sorry, DESC needs DOS 3+ and 4DOS 4+!
- ECHO. (currently you have DOS %_DOSVER and 4DOS %_4VER)
- QUIT 1
- ENDIFF
-
- REM Check free env and alias space
- IFF "%_ENV%" != "" .AND. 0%_ENV% LE 500 THEN
- ECHO. Sorry, DESC needs at least 500 byte free environment.
- ECHO. (currently you have %_ENV free bytes in the environment)
- QUIT 1
- ENDIFF
-
- IFF "%_ALIAS%" != "" .AND. 0%_ALIAS% LE 075 THEN
- ECHO. Sorry, DESC needs at least 100 byte free alias space!
- ECHO. (currently you have %_ALIAS free space for new aliasse)
- QUIT 1
- ENDIFF
-
- ELSE
- REM I don't like Windows NT
- ECHO. Sorry, DESC do not know the operating system %_dos% %_dosVer%!
- QUIT 1
- ENDIFF
-
- IFF "%DescActiv%" != "" THEN
- ECHO. DESC is already activ. Use 'EXIT' to return to DESC.
- QUIT 1
- ENDIFF
-
- REM please don't change this!
- alias cc scrput 0 15 whi on blue DESC %DESCVersion% Copyright (c) by Bernd Schemmer 1993
-
- REM get the path for data files
- IFF exist %initFile% THEN
- *SET iPath=%_cwds%
- ELSEIFF "%iPath%" != "" THEN
- IFF IsDir %IPath% THEN
- IF NOT EXIST %iPath%CON *SET iPath=%iPath%\
- ELSE
- ECHO. [DESC] Error: %iPath% (variable "iPath" is NOT a directory!
- QUIT 1
- ENDIFF
- ELSE
- *SET iPath=%@path[%@search[%0%]]
- IF "%iPath%" == "" *SET iPath=%@path[%0%]
- IF "%iPath%" == "" *SET iPath=%@path[%@search[%@name[%0%].%@ext[%0%]]]
- IF "%iPath%" == "" *SET iPath=%_cwds
- ENDIFF
-
- REM get path for the temp files
- IF NOT EXIST %TMP%CON *SET TMP=%TMP%\
- IF NOT EXIST %TMP%CON *SET TMP=C:\
- *SET TMPFIL=%@UNIQUE[%TMP%]
-
- REM get foreground and background color
- CLS
- *SET clrF=%_fg
- *SET clrB=%_bg
-
- *UNSET /Q KStack
- IFF "%_DOS" == "DOS" THEN
- REM check if KSTACK is loaded
- keystack #00 >&NUL
- REM set KStack to Y if so
- IF %_? == 0 *SET KStack=Y
- ENDIFF
- REM SET default var values
- *SET mline1=%@eval[%_rows-6]
- *SET mline2=%@eval[%_rows-5]
- *SET mline3=%@eval[%_rows-1]
- REM DESC Version
- *SET DESCVersion=V2.11
- REM Describe or change dirs
- *SET DescDirs=OFF
- REM Describe or view files
- *SET ViewFiles=OFF
- REM filemask
- *SET mask=*.*
-
- REM dirs with the pack program(s)
- IF "%DOSArc%" == "" *SET DOSarc=D:\UTILS\ARCHIV
- IF "%OS2Arc%" == "" *SET OS2arc=C:\OS_2\TOOLS\ARCHIV
-
- REM magic for the filemask
- *SET archivs=*.ARJ;*.ZIP;*.LZH;*.ZOO;*.SQZ;*.LHA;*.PAK;*.ICE;*.ARC
-
- REM magic for the filemask
- IFF "%_DOS" == "DOS" THEN
- *SET exes=*.EXE;*.COM;*.BAT;*.BTM
- ELSE
- *SET exes=*.EXE;*.CMD;*.BTM
- ENDIFF
-
- REM magic for the filemask
- *SET all=*.*
- REM variable with the magics
- *SET magics=EXES ARCHIVS ALL
- REM filename for the drivemap
- *SET DriveMap=%iPath%DESCDRVM
-
- REM load configuration if possible
- IFF "%initFile%" != "" THEN
- IFF EXIST %ipath%%initFile% THEN
- *SET msg=Executing configuration file "%ipath%%initfile%" ....
- GOSUB ShowMsg
- call %iPath%%initFile%
- ENDIFF
- ENDIFF
- GOSUB ClearMsg
-
- IFF "%_DOS%" == "DOS" THEN
- *SET arcPath=%DOSArc%
- ELSE
- *SET arcPath=%OS2Arc%
- ENDIFF
-
- REM errorlevel of internal cmds
- *SET iErr=0
- REM semaphor for reReading dirs
- *SET ReadDir=Y
-
- IF "%1%" == "" GOTO LOOP
- REM proceed parameter
- IFF "%1%" != "%xParm%" THEN
- REM let describe do the work
- *describe %1&
- QUIT %_?
- ENDIFF
-
- pushd
-
- FOR %%t IN (%2&) DO GOSUB ProceedParm
- QUIT %_?
-
- REM ------------------------------------
-
- :LOOP
-
- REM interactive mode
- IFF "%ReadDir%" == "Y" THEN
- IF EXIST %TMPFIL% DEL /Q %TMPFIL%
-
- *SET msg=Checking directory %_cwd. Please wait ...
- GOSUB ShowMsg
-
- REM create file list of current Dir
- IFF "%_DOS" != "DOS" THEN
- ECHO.■Current workdirectory is %_CWD>>!%TMPFIL%
- ELSE
- IFF %_CWD == %@truename[%_CWD] THEN
- ECHO.■Current workdirectory is %_CWD>>!%TMPFIL%
- ELSE
- ECHO.■Current workdirectory is %_CWD (= %@truename[%_CWD] )>>!%TMPFIL%
- ENDIFF
- ENDIFF
-
- ECHO.■Change file mask (current mask is %mask%)>>!%TMPFIL%
- ECHO.■Toggle Describe Dirs-Switch (ON: Describe Dirs - OFF: Change Dir)>>%TMPFIL%
- ECHO.■Toggle View Files-Switch (ON: view files - OFF: edit file desc.)>>%TMPFIL%
-
- IFF "%_DOS" == "DOS" THEN
- ECHO.■4DOS V%_4VER Shell (%_DOS %_DOSVER)>>%TMPFIL%
- ELSE
- ECHO.■4OS2 V%_4VER Shell (%_DOS %_DOSVER)>>%TMPFIL%
- ENDIFF
-
- ECHO.■Delete file(s)>>%TMPFIL%
- ECHO.■Delete a Directory-Tree>>%TMPFIL%
- ECHO.■Clear all descriptions>>%TMPFIL%
- ECHO.■Erase some descriptions>>%TMPFIL%
- ECHO.■Edit some descriptions>>%TMPFIL%
- ECHO.■Directory-Tree>>%TMPFIL%
- ECHO.■Available Drives>>%TMPFIL%
- ECHO.■Root-Directory>>%TMPFIL%
- ECHO.------------------------------------------------------------------------------->>%TMPFIL%
-
- IFF "%_DOS" == "DOS" THEN
- REM MS-DOS or PC-DOS
- DIR /KM /AD *.* /oGEN >>!%TMPFIL% >&>NUL
- ECHO.------------------------------------------------------------------------------->>%TMPFIL%
- DIR /KM /A-D /oGEN %mask% >>!%TMPFIL% >&>NUL
- ELSE
- REM OS/2
- DIR /Z /KM /AD /oGEN *.* >>!%TMPFIL% >&>NUL
- ECHO.------------------------------------------------------------------------------->>%TMPFIL%
- DIR /Z /KM /A-D /oGEN %mask% >>!%TMPFIL% >&>NUL
- ENDIFF
-
- ENDIFF
-
- CLS
- GOSUB ClearMsg
- *SET ReadDir=Y
- cc
-
- *UNSET /Q n1
- IF %@len[%_cwds] GT 3 *SET n1=2
- *SET n1=%@eval[%@lines[%tmpfil%]-14- %n1]
-
- *SET cmd1=%@WORD[0,"%@SELECT[%TMPFIL%,2,0,%@eval[%_rows-1],%@eval[%_columns-1], Edit descriptions for %n1% files/dirs / Describe Dirs = %DescDirs% ViewFiles = %ViewFiles% ]"]
- IF %cmd1% == "" GOTO End
-
- REM *** only for HPFS formated output
- REM *SET FILE=%@WORD[-0,%@substr[%cmd1%,1,%@eval[%@len[%cmd1%]-2]]]
-
- *SET cmd1=%@SUBSTR[%cmd1%,1,12]
- *SET file=%cmd1%
-
- REM proceed user choice (=%cmd1%)
- IFF %@INDEX[%cmd1%,■Delete f] != -1 THEN
- IFF NOT EXIST %mask% THEN
- *SET msg=There are no files in the directory %_cwd
- *SET msg1=for the current file mask. The current file mask is "%mask%".
- GOSUB ShowAsk
- *SET ReadDir=N
- ELSE
- GOSUB chkdrive
- *SET ReadDir=N
- IFF %Ierr% == 0 THEN
- *UNSET /Q Files_To_Delete
- select /A /OGEN *SET Files_To_Delete=[%mask%]
- IFF "%Files_To_Delete%" != "" THEN
- del /Q /y %Files_To_Delete%
- *SET readDir=Y
- ENDIFF
- *UNSET /Q Files_To_Delete
- ENDIFF
- ENDIFF
- cls
-
- ELSEIFF %@index[%cmd1%,■Directory] != -1 THEN
- GOSUB getDirTree
- *SET ReadDir=N
- IFF "%dirl%" != "" THEN
- cdd %dirl%
- *SET ReadDir=Y
- ENDIFF
-
- ELSEIFF %@INDEX[%cmd1%,■Delete] != -1 THEN
- *UNSET /Q Directory_to_delete
- select /AD *SET Directory_to_Delete=[*.*]
- *SET ReadDir=N
- IFF "%Directory_To_Delete%" != "" .AND. "%Directory_To_Delete%" != "." .AND. "%Directory_To_Delete%" != ".." THEN
- *SET msg=Delete the directory "%Directory_To_Delete%" and ALL sub directorys.
- GOSUB ShowMsg
- inkey /K"ynYN" Really delete this directory tree (y/n)? %%c
- IFF "%@upper[%c%]" == "Y" THEN
- *SET msg=Deleting the directory tree "%Directory_To_Delete%" ...
- GOSUB ShowMSG
- del /s/y/x %Directory_To_Delete% >&NUL
- *SET ReadDir=Y
- ENDIFF
- *UNSET /Q Directory_To_Delete
- GOSUB ClearMsg
- ENDIFF
-
- ELSEIFF %@INDEX[%cmd1%,■Erase] != -1 THEN
- IFF NOT EXIST %mask% THEN
- *SET msg=There are no files in the directory "%_cwd%"!
- *SET msg1=(Current file mask is "%mask%")
- GOSUB ShowAsk
- *SET ReadDir=N
- ELSE
- GOSUB chkdrive
- *SET ReadDir=N
- IFF %Ierr% == 0 THEN
- *UNSET /Q Files_To_Delete_Description
- select /OGEN *SET Files_To_Delete_Description=[%mask%]
- IFF "%Files_To_Delete_Description%" != "" THEN
- FOR %%f IN (%Files_To_Delete_Description%) DO describe %f ""
- *SET readDir=Y
- ENDIFF
- *UNSET /Q Files_To_Delete_Description f
- ENDIFF
- ENDIFF
- cls
-
- ELSEIFF %@INDEX[%cmd1%,■Edit] != -1 THEN
- IFF NOT EXIST %mask% THEN
- *SET msg=There are no files in the directory "%_cwd%"!
- *SET msg1=(Current file mask is "%mask%")
- GOSUB ShowAsk
- *SET ReadDir=N
- ELSE
- GOSUB chkdrive
- *SET ReadDir=N
- IFF %Ierr% == 0 THEN
- *UNSET /Q Files_To_Describe
- select /OGEN *SET Files_To_Describe=[%mask%]
- IFF "%Files_To_Describe%" != "" THEN
- describe %Files_To_Describe% ""
- *SET readDir=Y
- ENDIFF
- *UNSET /Q Files_To_Describe
- ENDIFF
- ENDIFF
- cls
-
- ELSEIFF %@INDEX[%cmd1%,■Toggle D] != -1 THEN
- IFF "%DescDirs%" == "ON" THEN
- *SET DescDirs=OFF
- ELSE
- *SET DescDirs=ON
- ENDIFF
- *SET ReadDir=N
-
- ELSEIFF %@INDEX[%cmd1%,■Toggle V] != -1 THEN
- IFF "%ViewFiles%" == "ON" THEN
- *SET ViewFiles=OFF
- ELSE
- *SET ViewFiles=ON
- ENDIFF
- *SET ReadDir=N
-
- ELSEIFF %@INDEX[%cmd1%,■4DOS] != -1 .OR. %@INDEX[%cmd1%,■4OS2] != -1 THEN
- SCREEN 1 0
- *SET DESCactiv=Y
-
- :DosShellLoop
- ECHO.
- ECHO.--- Type EXIT to return to DESC ... ---
- INPUT [%_cwds%] Enter command(s) to execute: %%l
- IFF "%@upper[%l%]" != "EXIT" THEN
- IF "%l" != "" call %l
- GOTO DosShellLoop
- ENDIFF
- *UNSET /Q DescActiv
- GOTO Loop
-
- ELSEIFF %@INDEX[%cmd1%,■Clear] != -1 THEN
- *SET ReadDir=N
- IFF EXIST descript.ion THEN
- GOSUB chkdrive
- IFF %Ierr == 0 THEN
- del /Z /Q descript.ion
- *SET readDir=Y
- ENDIFF
- ENDIFF
-
- ELSEIFF %@INDEX[%cmd1%,-----] != -1 THEN
- *SET ReadDir=N
-
- ELSEIFF %@INDEX[%cmd1%,■Current] != -1 THEN
- *SET msg=Current work directory is "%_cwd%".
- GOSUB ShowMsg
- INPUT Enter new work directory (RETURN = no change): %%t
- *SET ReadDir=N
- IFF "%t%" != "" THEN
- IF NOT EXIST %t%CON .AND. %t% != - *SET t=%t%\
- IFF NOT EXIST %t%CON .AND. %t% != - THEN
- *SET msg=Error: "%t%" is NOT a directory!
- GOSUB ShowAsk
- ELSE
- cdd %t%
- *SET ReadDir=Y
- ENDIFF
- ENDIFF
- GOSUB ClearMsg
-
- ELSEIFF %@INDEX[%cmd1%,■Change] != -1 THEN
- *SET msg=Current filemask is "%mask%".
- *SET msg1=Magics are "%magics%"
- GOSUB ShowMsg
- *SET ReadDir=N
-
- INPUT Enter new filemask (RETURN = no change): %%t
- IFF "%t%" != "" THEN
- *SET mask=%t%
- *SET ReadDir=Y
- ENDIFF
- GOSUB ClearMsg
-
- ELSEIFF %@INDEX[%cmd1%,■Root] != -1 THEN
- CD \
-
- ELSEIFF %@INDEX[%cmd1%,■Available] != -1 THEN
- GOSUB GetDrives
-
- ELSEIFF "%@SUBSTR[%file%,0,2]" == ".." THEN
- IFF "%DescDirs%" == "OFF" THEN
- CD ..
- ELSE
- *SET ReadDir=N
- ENDIFF
-
- ELSEIFF IsDir %file% .AND. "%DescDirs%" == "OFF" THEN
- CD %file%
-
- ELSE
- IFF %ViewFiles% == OFF THEN
- GOSUB chkdrive
- ELSE
- *SET IErr=0
- ENDIFF
- *SET ReadDir=N
-
- IFF %Ierr% == 0 THEN
- *UNSET /Q attr
-
- IF %@attrib[%file%,H] == 1 *SET attr=%attr%H
- IF %@attrib[%file%,S] == 1 *SET attr=%attr%S
- IF "%attr%" != "" attrib /D -hs %file% >&NUL
-
- IFF %ViewFiles% == OFF .OR. IsDir %file% THEN
- GOSUB DES
- *SET ReadDir=Y
- ELSE
- GOSUB ViewFile
- ENDIFF
-
- IF "%attr%" != "" attrib /D +%attr% %file% >&NUL
- *UNSET /Q attr
- ENDIFF
- ENDIFF
-
- GOTO LOOP
-
- :End
- IF EXIST %TMPFIL% DEL /Q %TMPFIL%
-
- IFF "%initFile%" != "" THEN
- *SET msg=Saving configuration in "%iPath%%initFile%" ....
- GOSUB ShowMsg
- GOSUB SaveDescVars
- ENDIFF
- cls
- ECHO. Have a nice day ...
- QUIT 0
-
- REM ----------------------------------------
-
-
- REM ----- getDirTree
- REM choose a directory out of a directory tree
- REM input: %iPath% = directory for the treemap file
- REM output: %dirl% = choosen dir (or empty)
- REM
- :getDirTree
-
- *UNSET /Q dirL
-
- *SET TreeDrive=%@lower[%_Disk%]
- *SET TreeMap=%iPath%DESCTree.%TreeDrive%
- *SET ReadTree=old
- *SET vStr=■Directory-Tree for %TreeDrive%: created by DirTree %DescVersion%
-
- IF %@FileSize[%TreeMap%,B] LE 0 GOTO getTree
- IF %@index[%@line[%TreeMap%,0],%vStr%] == 0 GOTO ShowDirTree
-
- :GetTree
-
- IFF %@ready[%TreeDrive%:] != 1 THEN
- *SET msg=Error: Drive "%TreeDrive%:" is not ready!
- GOSUB ShowMsg
- GOTO GetTreeEnd
- ENDIFF
-
- *SET msg=Checking directory structure of "%TreeDrive%:". Please wait ...
- GOSUB ShowMsg
-
- *SET ReadTree=new
-
- ECHO.%vstr% at %_DATE %_TIME>!%TreeMap%
- ECHO.■ReRead Directory Structure>>!%TreeMap%
- ECHO.------------------------------------------------------------------------------->>%TreeMap%
-
- *SET f=%@unique[%tmp%]
- dir %TreeDrive%:\ /1/AD/B/S/F/Ou >>!%f%
- sort <%f% >>%TreeMap%
- del %f%>NUL
-
- :ShowDirTree
- *UNSET /Q vstr
- CLS
- *SET dirN=%@eval[ %@lines[%TreeMap%] - 2]
- *SET dirL=%@SELECT[%TreeMap%,2,0,%@eval[%_rows-1],%@eval[%_columns-1], (%readTree%) Choose one of the %dirN% Directorys ]
-
- IF "%dirL%" == "" GOTO GetTreeEnd
- IF %@index["%dirL%",-----] == 1 GOTO ShowDirTree
-
- IFF %@INDEX[%dirL%,■ReRead] != -1 THEN
- DEL /Q %TreeMap% >&NUL
- GOTO GetDirTree
- ENDIFF
- IF %@INDEX[%dirL%,■Directory-Tree] != -1 GOTO ShowDirTree
-
- :GetTreeEnd
- *UNSET /Q f vstr readTree dirMap TreeDrive
- RETURN
-
- REM ----- viewFile
- REM Show the contents of the file or archiv
- REM input: %file% = file to view
- REM
- :ViewFile
- CLS
- *SET t=%@upper[%@ext[%file%]]
-
- *SET f=%@unique[%tmp%]
- cc
-
- *SET msg=Reading file "%file%" ...
- GOSUB ShowMsg
-
- IFF "%t%" == "EXE" .OR. "%t%" == "COM" THEN
- *SET msg=Known Archiv Types: ARJ, LHA, LZH, ICE, ZIP, ZOO, PAK, ARC, SQZ
- GOSUB ShowMsg
- *UNSET /Q t
- INPUT Enter the type of the Archiv "%file%": %%t
- GOSUB ClearMSG
- ENDIFF
-
- IFF "%t%" == "" THEN
- *list %file%
-
- ELSEIFF "%t%" == "ARJ" THEN
-
- %arcPath%\ARJ.EXE l %file% >&!%f%
- :ShowArj
- *SET msg=Viewing archiv "%file%" ...
- GOSUB ShowMsg
- *SET na=%@WORD[0,%@SELECT[%f%,2,0,%@eval[%_rows-1],%@eval[%_columns-1], Select a file to view or ESC to abort ]]
- IF "%na%" == "" GOTO EndView
- *SET msg=Extracting file "%na%" ...
- GOSUB ShowMsg
-
- %arcPath%\ARJ.EXE p %file% %na% |& *list /s
- GOSUB ClearMsg
- GOTO /I ShowArj
-
- ELSEIFF "%t%" == "LZH" .OR. "%t%" == "LHA" .OR. "%t%" == "ICE" THEN
- %arcPath%\LHA.EXE l %file% >&!%f%
- :ShowLZH
- *SET msg=Viewing archiv "%file%" ...
- GOSUB ShowMsg
- *SET na=%@WORD[0,%@SELECT[%f%,2,0,%@eval[%_rows-1],%@eval[%_columns-1], Select a file to view or ESC to abort ]]
- IF "%na%" == "" GOTO EndView
-
- *SET msg=Extracting file "%na%" ...
- GOSUB ShowMsg
- %arcPath%\LHA.EXE p %file% %na% |& *list /s
- GOSUB ClearMsg
- GOTO /I ShowLZH
-
- ELSEIFF "%t%" == "SQZ" THEN
- %arcPath%\SQZ.EXE l %file% >&!%f%
- :ShowSQZ
- *SET msg=Viewing archiv "%file%" ...
- GOSUB ShowMsg
- *SET na=%@WORD[0,%@SELECT[%f%,2,0,%@eval[%_rows-1],%@eval[%_columns-1], Select a file to view or ESC to abort ]]
- IF "%na%" == "" GOTO EndView
-
- *SET msg=Extracting file "%na%" ...
- GOSUB ShowMsg
- %arcPath%\SQZ.EXE p %file% %na% |& *list /s
- GOSUB ClearMsg
- GOTO /I ShowSQZ
-
- ELSEIFF "%t%" == "ZIP" THEN
- %arcPath%\PKUNZIP.EXE -v %file% >&!%f%
- :ShowZIP
- *SET msg=Viewing archiv "%file%" ...
- GOSUB ShowMsg
- *SET na=%@WORD[8,%@SELECT[%f%,2,0,%@eval[%_rows-1],%@eval[%_columns-1], Select a file to view or ESC to abort ]]
- IF "%na%" == "" GOTO EndView
-
- *SET msg=Extracting file "%na%" ...
- GOSUB ShowMsg
- %arcPath%\PKUNZIP.EXE -c %file% %na% |& *list /s
- GOSUB ClearMsg
- GOTO /I ShowZIP
-
- ELSEIFF "%t%" == "ZOO" THEN
- %arcPath%\ZOO.EXE l %file% >&!%f%
- :ShowZOO
- *SET msg=Viewing archiv "%file%" ...
- GOSUB ShowMsg
- *SET na=%@WORD[7,%@SELECT[%f%,2,0,%@eval[%_rows-1],%@eval[%_columns-1], Select a file to view or ESC to abort ]]
- IF "%na%" == "" GOTO EndView
-
- *SET msg=Extracting file "%na%" ...
- GOSUB ShowMsg
- %arcPath%\ZOO -p %file% %na% |& *list /s
- GOSUB ClearMsg
- GOTO /I ShowZOO
-
- ELSEIFF "%t%" == "PAK" .OR. "%t%" == "ARC" THEN
- %arcPath%\PAK.EXE v %file% >&!%f%
- :ShowPAK
- *SET msg=Viewing archiv "%file%" ...
- GOSUB ShowMsg
- *SET na=%@SUBSTR[%@SELECT[%f%,2,0,%@eval[%_rows-1],%@eval[%_columns-1], Select a file to view or ESC to abort ],0,12]
- IF "%na%" == "" GOTO EndView
- *SET na=%@WORD[0,%na%].%@WORD[1,%na%]
-
- *SET msg=Extracting file "%na%" ...
-
- GOSUB ShowMsg
-
- %arcPath%\PAK.EXE p %file% %na% |& *list /s
- GOSUB ClearMsg
- GOTO /I ShowPAK
- ELSE
- *list %file%
- ENDIFF
-
- :EndView
- IF EXIST %f% DEL /Q %f%
- *UNSET /Q na
- RETURN
-
- REM ----- chkdrive
- REM Test if the current drive is ready to write
- REM output: iErr == 0 - okay, iErr != 0 - error
- REM
- REM note: Only works, if KSTACK is loaded (DOS-Version)
- REM
- :chkdrive
- *SET iErr=0
-
- IFF "%KSTACK%" == "" THEN
- REM KSTACK NOT loaded
- IF %@ready[%_cwd%] != 1 *SET iErr=1
- RETURN
- ENDIFF
-
- CLS
- *SET msg=Testing directory "%_cwd%" ...
- GOSUB ShowMsg
- SCREEN %mline2 1
- keystack CTRL-Z ENTER 0 "I"
- copy con $$TEMP$$
- *SET iErr=%_?
- keystack 0
- CLS
- SCREEN %mline2 1
- IFF %iErr == 0 THEN
- DEL $$TEMP$$
- GOSUB ClearMsg
- RETURN
- ENDIFF
- *SET msg=Error: Can't write to the directory "%_CWD" (4DOS error %iErr%)!
- GOSUB ShowAsk
- RETURN
-
- REM ----- Des - Edit the description of the choosen file
- REM Input: %file% = filename
- :DES
- CLS
- GOSUB ClearMSG
- DRAWHLINE %mline1 0 %@eval[%_columns -1] 1 BRI WHI ON CYAN
- DRAWHLINE %mline3 0 %@eval[%_columns -1] 1 BRI WHI ON CYAN
- SCREEN %mline2 1
- DESCRIBE %file%
- CLS
- RETURN
-
- REM ---- GetDrives - Choose a drive out of a drive list
- REM
- :GetDrives
- *SET Read=old
-
- *SET vStr=■Drive-Map created by DriveMap %DescVersion%
-
- IF %@FileSize[%DriveMap%,B] LE 0 GOTO GetDriveMap
- IF %@index[%@line[%DriveMap%,0],%vStr%] == 0 GOTO GLoopEnd
-
- :GetDriveMap
- *SET msg=Checking drives. Please wait ...
- GOSUB ShowMsg
- *SET Read=new
-
- *SET n=65
- *SET n1=1
- *SET n2=0
-
- ECHO.%vstr% at %_DATE %_TIME>!%DriveMap%
- ECHO.■ReRead Drive Map>>!%DriveMap%
- ECHO.------------------------------------------------------------------------------->>%DriveMap%
- ECHO.Drive --- Description ---- Total Space Free Space Volume >>!%DriveMap%
-
- *SET c=%@CHAR[%n%]
-
- :GLoop
- *SET c=%c%:
- *SET t= %c%
-
- IF "%KSTACK%" != "" keystack 0 enter
- *SET r=%@ready[%c%]
- IF "%KSTACK%" != "" keystack 0
- IFF %_row != %@eval[%_rows -4] THEN
- *SET msg=Checking drives. Please wait ...
- GOSUB ShowMsg
- ENDIFF
-
- IF %r% == 1 *SET n2=%@eval[%n2 +1]
-
- IFF %@REMOVABLE[%c%] == 1 THEN
- *SET t=%t% [removable]
- ELSE
- *SET t=%t% [fixed ]
- ENDIFF
-
- IFF %r% == 1 THEN
- IFF %@REMOTE[%c%] == 1 THEN
- *SET t= %t% [remote]
- ELSE
- *SET t= %t% [local ]
- ENDIFF
- ELSE
- *SET t= %t% [n/a ]
-
- ENDIFF
-
- IFF %r% == 1 THEN
- *SET t1=%@DiskTotal[%c%,K] kb
- *SET t=%t% %@substr[` `,1,%@eval[12-%@len[%t1%]]] %t1%
-
- *SET t1=%@DiskFree[%c%,K] kb
- *SET t=%t% %@substr[` `,1,%@eval[12-%@len[%t1%]]] %t1%
-
- *SET t1=%@label[%c%]
-
- IFF "%t1%" == "" THEN
- *SET t=%t% [n/a]
- ELSE
- *SET t=%t% %@label[%c%]
- ENDIFF
-
- ENDIFF
-
- ECHO.%t%>>!%DriveMap%
- *SET n=%@eval[%n +1]
-
- *SET c=%@CHAR[%n%]
- IF %c% GT %@upper[%_LASTDISK] GOTO GLoopEnd
-
- *SET n1=%@eval[%n1 +1]
- GOTO GLoop
-
- :GLoopEnd
- *UNSET /Q vstr
- CLS
- CC
- IFF "%read%" == "old" THEN
- *SET n2=???
- *SET n1=%@eval[ %@lines[%driveMap%]-3]
- ENDIFF
- *SET c=%@SELECT[%DriveMap%,2,0,%@eval[%_rows-1],%@eval[%_columns-1], (%read%) %n1% Drives [%n2% available, current drive is %_disk:] ]
-
- IFF "%c%" == "" THEN
- *SET ReadDir=N
- RETURN
- ENDIFF
- IF %@index["%c%",Drive] == 1 GOTO GLoopEnd
- IF %@index["%c%",-----] == 1 GOTO GLoopEnd
-
- IFF %@INDEX[%c%,■ReRead] != -1 THEN
- DEL %DriveMap% >&NUL
- GOTO GetDrives
- ENDIFF
- IF %@INDEX[%c%,■Drive-Map] != -1 GOTO GLoopEnd
- *SET c=%@SUBSTR["%c%",4,2]
-
- IFF %@READY[%c%] != 1 THEN
- *SET msg=Error: Drive "%c%" is NOT ready!
- GOSUB ShowAsk
-
- GOTO GLoopEnd
- ENDIFF
- %c%
- RETURN
-
- REM ----- ShowAsk - Show a msg and wait for a key
- REM Input: %msg% = Message
- REM
- :ShowAsk
- *SET wait=Y
- GOSUB ShowMsg
-
- :ClearMsg
- *UNSET /Q msg
-
- :ShowMsg
- REM ----- ShowMsg - Show a msg
- REM Input: %msg% = Message
- REM %wait% = Y ->> wait for a key and delete message
- REM else ->> return without deleting the message!
- REM
-
- CLS
- cc
- REM clear the message box
- DRAWHLINE %mline1 0 %@eval[%_columns%] 1 BRI RED ON CYAN
- *SET n=%@eval[%mline1 +1]
- SCRPUT %n% 0 %clrF ON %clrB ` `
- *SET n=%@eval[%n +1]
- SCRPUT %n% 0 %clrF ON %clrB ` `
- *SET n=%@eval[%n +1]
- SCRPUT %n% 0 %clrF ON %clrB ` `
- *SET n=%@eval[%n +1]
- SCRPUT %n% 0 %clrF ON %clrB ` `
-
- DRAWHLINE %mline3 0 %@eval[%_columns%] 1 BRI RED ON CYAN
- IF "%msg%" == "" RETURN
-
- *SET n=%mline2%
-
- SCRPUT %n% 1 %clrF ON %clrB [DESC] %msg%
-
- IFF "%msg1%" != "" THEN
- *SET n=%@eval[%n +1]
- SCRPUT %n% 1 %clrF ON %clrB ` `%msg1%
- ENDIFF
- SCREEN %@eval[%n +1] 1
- *UNSET /Q msg msg1 n
- IF "%wait%" != "Y" RETURN
-
- *UNSET /Q wait
- SCREEN %@eval[%_rows-2] %@eval[(%_columns/2) - 10]
- INKEY --- Press any key --- %%wait
- CLS
- IF "%wait%" == "@45" QUIT 2
- *UNSET /Q wait
- RETURN
-
- REM ----- Save DESC vars
- REM
- REM
- :SaveDescVars
- IF EXIST %ipath%%initFile% DEL /Q %ipath%%initFile%
- ECHO.@ECHO OFF >!%iPath%%InitFile%
- ECHO.REM ----- Values for the environment variables of DESC.BTM %DESCversion% >>%iPath%%InitFile%
- ECHO.REM>>%iPath%%InitFile%
- ECHO.*SET DescDirs=%DescDirs%>>%iPath%%InitFile%
- ECHO.*SET ViewFiles=%ViewFiles%>>%iPath%%InitFile%
- ECHO.*SET mask=%@upper[%mask%]>>%iPath%%InitFile%
- ECHO.*SET DOSArc=%@upper[%DOSarc%]>>%iPath%%InitFile%
- ECHO.*SET OS2Arc=%@upper[%OS2arc%]>>%iPath%%InitFile%
-
- *SET l=0
- :MagicLoop
- *SET t=%@upper[%@word[%l%,%magics%]]
- IF "%t%" == "" GOTO MagicLoopEnd
- *SET l=%@eval[%l +1]
- ECHO.*SET %t%=%[%t%]>>%iPath%%InitFile%
- GOTO MagicLoop
- :MagicLoopEnd
- *UNSET /Q l t
-
- ECHO.*SET magics=%@upper[%magics%]>>%iPath%%InitFile%
-
- ECHO.*SET driveMap=%DriveMap%>>%iPath%%InitFile%
- ECHO.>>%iPath%%InitFile%
- ECHO.*SET lastDir=%_CWDS>>%initFile%
- RETURN
-
- REM ------------------------------------
- REM ProceedParm
- REM
- REM Function: Proceed a parameter
- REM
- REM input: %t% = current parameter
- REM
- REM Note: only called if the first parameter is %xParm%
- REM
- :ProceedParm
- *SET file=%t%
-
- IFF "%@ready[%file%]" != "1" THEN
- *SET msg=Warning: Can NOT access "%file%"!
- GOSUB ShowAsk
- ELSEIFF isDir %file% THEN
- cdd %file%
-
- ELSEIFF NOT EXIST %file% THEN
- *SET msg=Warning: Can NOT find the file "%file%"!
- GOSUB ShowAsk
-
- ELSE
- pushd
- IF "%@PATH[%file%]" != "" cdd %@PATH[%file%]
- *SET file=%@NAME[%file%].%@EXT[%file%]
- GOSUB ViewFile
- popd
- ENDIFF
- RETURN
-
- REM ----------------------------------------
-
-